Friday, November 22, 2013

Android: How to Launch Another App from Your App

I have been learning Android from quite sometime now, and in fact I am learning, hacking, and experimenting and doing some minimal development. sometimes its good to tell, how you did it may be it would help someone out there.

As you know in android everything has an Intent, so to launch another App from your app, you can create an Intent within your app saying that you want to launch the other App and then using that Intent start the activity as shown below.

Intent i = new Intent();
i.setComponent(new ComponentName ( "com.shetty.test","com.shetty.test.MainActivity"));

Here what you need to notice is that the FLAG_ACTIVITY_NEW_TASK needs to be set, so that this is launched as a new task, else would result in Force Close.

No comments:

Post a Comment