Android explicit intent with target component

Lukap picture Lukap · Jul 26, 2011 · Viewed 36k times · Source

Is it possible to fire explicit intent but not for an activity from my project but for activity in some other application.

I am sure of this code and I know it is running

Intent i=new Intent(this,MyActivity.class);

But is it possible to do something like this

Intent i=new Intent(this,com.bzz.bla.bla.SomeActivity.class);

I mean what is the exact way of explicitly starting activity from other application (activity that is contained in other apk), is this possible at all ?

I tried but it drops me force close message.

Answer

SRam picture SRam · Jul 26, 2011

Yes it's possible. But creation of intent is different.Try this:

Intent intent = new Intent();
intent.setComponent(new ComponentName("The package name of the activity that you wish to launch","Its fully qualified class name"));
startActivityForResult(intent);