Launch External Android App from Within Android App

If you want to launch or open another android app from your own app you can do simply with intent and package manager. From this sample code we will open external android app using button, you can use textview or another view component.

public class MainActivity extends Activity {

private Button otherapp;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

otherapp = (Button) findViewById(R.id.openApp);
otherapp.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

Intent i = new Intent();
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("other.package.app");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
}

});
}

}

 

change “other.package.app” with package name from the application which you want to launch. Done.

You can find package name from tutorial how to read package name of an android apk.

 

Like
Like Love Haha Wow Sad Angry
No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *