RMK
RMK

Reputation: 819

Open another one application from our application?

From my application i have to open a another one application.Is there any possibility to open like this?

Upvotes: 6

Views: 3608

Answers (3)

Christopher Gertz
Christopher Gertz

Reputation: 2026

You should use the function of the package manager.

try {
    Intent i = ctx.getPackageManager().getLaunchIntentForPackage("com.android.browser");
    ctx.startActivity(i);
} catch (NameNotFoundException e) {
    // TODO Auto-generated catch block
}

Upvotes: 9

Thorstenvv
Thorstenvv

Reputation: 5396

You can launch other applications with Activity.startActivity( intent);

Use it like this:

Intent intent = new Intent();
String pkg = "com.android.browser";
String cls = "com.android.browser.BrowserActivity";
intent.setClassName(pkg, cls); 
startActivity(intent);

You need to know the package and class names of the activity to call, the Package Browser in the Dev Tools app will help here if its not your own app to call.

Upvotes: 1

Pentium10
Pentium10

Reputation: 207820

Probably you are looking for a way to start another class from another package

Intent myIntent = new Intent();
myIntent.setClassName("com.android.samples", "com.android.samples.Animation1");
myIntent.putExtra("com.android.samples.SpecialValue", "Hello, Joe!"); // key/value pair, where key needs current package prefix.
startActivity(myIntent);    

Read a tutorial post about Opening a Screen at Common Tasks post.

Upvotes: 3

Related Questions