1


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);
  }
});
Ahmed Alnabhan
  • 608
  • 1
  • 9
  • 13
Patty
  • 13
  • 1
  • 5

1 Answers1

3

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);
khubaib
  • 535
  • 4
  • 12
  • Thanks for the fast answer! I could figure out the Package Name for one app by going to "My Files" on the phone and there to the "Android" folder and then "data". There are all the folders called "com.xxx.xxx". Your solution works perfectly when I use the name from there. But I can not find all apps there. How do I figure out the Package Names for other apps. – Patty Sep 08 '13 at 20:06
  • 2
    accept the answer if it works perfectly fine for you. for all the other apps connect your device via usb and open adb shell and execute this command to know d package name of all d apps.. pm list packages -f..... – khubaib Sep 09 '13 at 04:23
  • Thanks a lot for the help! I also found this very helpful: http://stackoverflow.com/a/8774973/2758609 – Patty Sep 09 '13 at 19:06