I am sure that you have already decided this, but I will write here anyway, if others, like me, land on this answer.
To launch a dialog box by clicking on a widget, you can define an action created as a dialog box and launch it when a widget is clicked.
First of all, add activity to the manifest, call it DialogWidgetActivity
<activity
android:name=".DialogWidgetActivity"
android:theme="@android:style/Theme.Dialog"
...
/>
Then in your WidgetProvider call him MyWidgetProvidersnap the click of the widget with the launch of the action
public class MyWidgetProvider extends AppWidgetProvider {
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
final int N = appWidgetIds.length;
for (int i = 0; i < N; i++) {
int appWidgetId = appWidgetIds[i];
Intent intent = new Intent(context, DialogWidgetActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.widget);
views.setOnClickPendingIntent(R.id.widget_container, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
}
, widget_container . , id widget_container, android:id="@+id/widget_container", .
, .
Android.
, :)