Pregunta


How can I launch an app (3rd party app) that is installed on my phone with my own app? I'm having several buttons in my app and when one has pressed an app that is installed should open, for example, Bank of America app. (I want to create a customized menu). I totally new to android programming, but could it work like this? What URI string could I use or how do I figure it out? Thanks a lot!

Button b_boa = (Button) findViewById(R.id.button_boa); 
b_boa.setOnClickListener(new View.OnClickListener() { 

 @Override
 public void onClick(View v) {
      Intent open_boa = new Intent(Intent.ACTION_VIEW,
      Uri.parse("_________")); 
      startActivity(open_boa);
  }
});
¿Fue útil?

Solución

You can launch a different app from your application on click of a button or something with the package name and if you dont know the launching activity of the application to be opened..You can use this

Intent LaunchIntent =     getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);

and if you know the launching activity also which you can see from the manifest file of the app to be open then use this.

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new    ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top