2011-08-01 22 views
0

私は私のStackViewため、この方法を実行するたびに...NULLエラーを返すRemoteViewAdapterメソッド?

@Override 
public RemoteViews getViewAt(int position) { 

    RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item); 


    Bundle extras = new Bundle(); 
    extras.putInt(stackWidgetProvider.EXTRA_ITEM, position); 
    Intent fillnIntent = new Intent(); 
    fillnIntent.putExtras(extras); 
    rv.setOnClickFillInIntent(R.id.widget_item, fillnIntent); 
    rv.setImageViewBitmap(R.id.wigdetView, bm); 
    MyTask myTask = new MyTask(); 
    myTask.execute(); 


    //Do heavy lifting here, Downloading images from a network or website. 

    return rv ; 
} 

私はデバッグにこのエラーが出ます..ここ

08-01 19:48:00.520: ERROR/RemoteViewsAdapter(14319): Error in updateRemoteViews(24): null 
08-01 19:48:05.530: ERROR/AppWidgetService(131): Error (unbindRemoteViewsService): Connection not bound 

は(私のupdateRemoteiewsである)、ここで...

public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { 

    for(int i = 0; i < appWidgetIds.length; ++i) { 

     Intent intent = new Intent(context, StackWidgetService.class); 
     intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); 

     intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); 
     RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout); 

     rv.setRemoteAdapter(appWidgetIds[i], R.id.stack_view, intent); 

     rv.setEmptyView(R.id.stack_view, R.id.add); 

     Intent toastIntent = new Intent(context, stackWidgetProvider.class); 
     toastIntent.setAction(stackWidgetProvider.TOAST_ACTION); 
     toastIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); 

     intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); 
     PendingIntent toastPendingIntent = PendingIntent.getBroadcast(context, 0, toastIntent, PendingIntent.FLAG_UPDATE_CURRENT); 
     rv.setPendingIntentTemplate(R.id.stack_view, toastPendingIntent); 

     appWidgetManager.updateAppWidget(appWidgetIds[i], rv); 
    } 

何が問題なのですか?

答えて

0

私はちょうど同じ問題を抱えていました。私の問題は、読み込んでいた画像が大きすぎるということでした。イメージのコードをコメントアウトした後、私の問題は解消されました。そこで、解決策を探す必要があります(私はhttps://groups.google.com/forum/#!topic/android-developers/bp8ddUGHGhEで解決策を探しています)。

このエラーは、ログcatに "FAILED Binder Transaction"も伴います。

関連する問題