• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps start acticity from widget

I' m trying to launch an activity while clicking on the screen widget.
I've found a way that the click on the screen widget launches the browser using pending intents.
I've tried using something like this, but it doesn't work.
Code:
 Intent defineIntent = new Intent(this,myActivityClass.class);
                PendingIntent pendingIntent = PendingIntent.getActivity(/*context,*/this,
                        0 /* no requestCode */, defineIntent, 0 /* no flags */);
                updateViews.setOnClickPendingIntent(R.id.widget, pendingIntent);

Any ideas of what should I look for?
 
You need to pass a flag in the call to get the intent when starting an activity from a broadcast receiver like an app widget. Had this same problem a few weeks ago and while the docs for the flags are very obvious about having to pass one, you have to be looking at that part of the docs to see them.
 
Back
Top Bottom