I have written a widget that cycles through a series of movie poster
images with next/prev buttons.  This works.  There is another button
on the widget that needs to launch an external activity, sending it
the name of the shown movie.  The other activity is not in the same
namespace, package or eclipse project as the widget.  It is written by
another developer and its apk is installed on my emulator.

What code do I need to start up an external activity from a widget?  I
tried this in my handleButtonAction() method.

Intent intent = new Intent( Intent.ACTION_VIEW );
intent.setClassName( context, "com.poof.ExternalMovieApp" );
intent.putExtra("FILENAME", MOVIES[state.currentMovie].filename);

PendingIntent pendingIntent = PendingIntent.getActivity( context, 0,
intent,
    PendingIntent.FLAG_UPDATE_CURRENT );

remoteView.setOnClickPendingIntent( R.id.btnDoIt, pendingIntent );

I tried it with and without the action parameter in the intent
constructor.  Either way, nothing happens when I press the button.  Is
this code wrong?  Do I need to add the external activity to my
manifest (how?)?  Is there a better way to get the external activity's
class name than hard coding it like this?

Are there any online examples that do this sort of thing?  All of the
examples i've seen merely launch configuration apps that are in the
same package as the widget.

Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to