我制作一个小部件。我想首先启动一个小部件 可以使用的活动(图库)选择主题小部件。选择消失后,将小部件作为小部件HTC时钟或HTC日历出现。有谁知道如何做到这一点? 感谢
答案 0 :(得分:0)
更新AppWidgetProvider
的onUpdate方法:
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
for (int appWidgetId : appWidgetIds) {
appid = appWidgetIds;
rview = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
Intent launchAppIntent = new Intent(context,Activityselecttheme.class);
launchAppIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
appWidgetId);
PendingIntent pendingActivity = PendingIntent.getActivity(context,
0, launchAppIntent, 0);
rview.setOnClickPendingIntent(R.id.widget, pendingActivity);
appWidgetManager.updateAppWidget(appWidgetId, rview);
}
}