2011-08-04 7 views
0

いくつかの画像をRemoteViewにロードしたいのですが、その方法をonUpdate()内で行う方法はありません。AppWidgetProviderクラスの画像を読み込むには、onUpdate()?

どうすればこのようにするのですか?

@Override 
    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); 


    } 
    super.onUpdate(context, appWidgetManager, appWidgetIds); 

} 

URLからいくつかの画像をロードしたいのですが、この部分の操作方法は分かります。私はちょうどonUpdate()でそれらを設定する方法を知りません。彼らはBitMapとして来る。

私はどのようにそれらをonUpdate()のRemoteViewに設定しますか?

答えて

0
Remoteview.setImageViewUri 
Remoteview.setBitmap 
Remoteview.setImageViewBitmap 
Remoteview.setImageViewResource 
+0

ここで画像のビューを定義しますか? –

+0

ビットマップは複数の画像です –

+0

"R.layout.widget_layout"に画像ビューを追加 – Pintac

関連する問題