我需要在 appwidget 上使用 onactivityresult 但我该如何使用它?它不叫
公共类 MainActivity 扩展 AppWidgetProvider 实现 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) {}