0

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.

1 Answers1

0

I see you posted this question before getting an answer to it at this question/answer (click)

You can read how it is done at the Android Developer site

Community
  • 1
  • 1
MarchingHome
  • 1,184
  • 9
  • 15