I know how to open an activity from a widget. It will open full screen.
Is it possible to open one inside a widget?
My activity is part of an application, it has a large code. The activity opens a camera and runs some algorithms. Can I have a 4×4 widget, and run the activity inside the widget with the algorithms of my project? (Basically a shortcut to the activity, but playing inside the widget).
@Override
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, ClassToLaunch.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
views.setOnClickPendingIntent(R.id.widget_id, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, views);
}
You cannot do this but you can make the best use of your layout and its updating intervals as widgets has its own life cycle.