Starting One Android App from Another App

丶灬走出姿态 提交于 2019-12-18 07:07:19

问题


What is the best way to start one android app from another app? Is it to send custom broadcast event and have broadcast receiver of other app catch this event and do a start activity on something? Thanks


回答1:


Use an Intent: http://developer.android.com/guide/topics/intents/intents-filters.html

Use Context.startActivity() to just launch, or Activity.startActivityForResult() if you want to get a result when it's done.

If you are tightly coupled with the other application, you can use an explicit Intent. Otherwise, send an implicit Intent.




回答2:


best way is call by intent like this

http://www.lacherstorfer.at/haris_blog/2008/03/android-howto-invoke-a-phone-c.html




回答3:


Use this:

PackageManager pm = getPackageManager();
try
{
    String packageName = "com.example.package";
    Intent launchIntent = pm.getLaunchIntentForPackage(packageName);
    startActivity(launchIntent);
}
catch (Exception e1)
{
}


来源:https://stackoverflow.com/questions/5281910/starting-one-android-app-from-another-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!