Sunday, June 20, 2010

Opening an Application using Intent

In Android, if we know the package name and the activity which is launching the application, we can open or launch the application from anywhere using Intent.

The code snippet is,

 
Intent intent = new Intent("android.intent.action.MAIN");
ComponentName component = new ComponentName("com.sample", "com.sample.Sample");
intent.setComponent(component );
startActivity(intent);

No comments:

Post a Comment

Androidians