appwidget で onactivityresult を使用する必要がありますが、どのように使用できますか? 呼ばれていない
public class MainActivity extends AppWidgetProvider implement OnActivityResultListener { Context context;
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
this.context = context;
for (int i = 0; i < appWidgetIds.length; i++) {
int appWidgetId = appWidgetIds[i];
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
PendingIntent pending = PendingIntent.getActivity(context, 0, intent, PendingIntent.PARCELABLE_WRITE_RETURN_VALUE);
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.activity_main);
views.setOnClickPendingIntent(R.id.imageButton1, pending);
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
}
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {}