Ive made a widget that once placed on the homescreen launches an activity
So I Have:
public class WidgetActivity extends AppWidgetProvider
{
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgets) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_activity);
Intent intent = new Intent(context, Info.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
remoteViews.setOnClickPendingIntent(R.id.Widget, pendingIntent);
}
}
And
public class Info extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.widget_activity_info);
}
}
But after successfully launching the widget_activity_info.xml the widget is not on the homescreen after pressing back or home. Am I missing anything here? The widget would stay on the screen before I made it launch the new activity.