Android 打开指定程序
程序员文章站
2022-06-04 08:51:22
...
Android App 打开指定程序
Core code:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(appFullName);
Sample
private void openTheSpecificApp (){
String appFullName = "your app full name";
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(appFullName);
if (launchIntent != null) {
startActivity(launchIntent);//null pointer check in case package name was not found
}
}
Notice: appFullName
should be the FULL NAME of that APP, like com.android.settings
…
核心代码:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(appFullName);
注意: appFullName
一定要是完整的app软件名字, 比如 com.android.settings
。
Enjoy coding!
上一篇: ARM A9,三星猎户座4412学习笔记
下一篇: u-boot主makefile分析2