由$ P $与我自己启动一个安装的应用pssing按钮 [英] launch an installed app with my own by pressing a button
问题描述
结果
我怎么可以启动已安装在手机上使用自己的应用程序的应用程序(第三方应用程序)。
我有几个按钮,在我的应用程序,当一个是pressed已安装应该打开应用,为美国应用的例子银行。 (我想创建一个像定制菜单)。
我全新到Android编程,但它可能像这样的工作?什么URI字符串我可以使用或我怎么看着办吧?非常感谢!结果
按钮b_boa =(按钮)findViewById(R.id.button_boa);
b_boa.setOnClickListener(新View.OnClickListener(){ @覆盖
公共无效的onClick(视图v){
意图open_boa =新意图(Intent.ACTION_VIEW,
Uri.parse(_________));
startActivity(open_boa);
}
});
您可以从您的应用程序上点击一个按钮或者用包名称,就会推出不同的应用程序,如果你不知道应用程序的启动活动将是opened..You可以使用此
意图LaunchIntent = getPackageManager()getLaunchIntentForPackage(com.package.address);
startActivity(LaunchIntent);
如果你知道的启动活动也,你可以从应用程序的清单文件中看到要开然后用这个。
意向意图=新意图(Intent.ACTION_MAIN);
intent.setComponent(新单元名(com.package.address,com.package.address.MainActivity));
startActivity(意向);
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 is pressed an app that is installed should open, for example Bank of America app. (I want to create like 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);
}
});
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);
这篇关于由$ P $与我自己启动一个安装的应用pssing按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!