Android工程开发笔记一
---------------------------------------不同 APP相互調(diào)用 activity
?
1.ComponentName()
Intent _Intent = new Intent(Intent.ACTION_MAIN);
_Intent.setComponent(new ComponentName("com.semp.skipdemo002","com.semp.skipdemo002.activity.SkipDemo002Activity"));
_Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(_Intent);
} catch (Exception e) {
// TODO Auto-generated catch block
Toast.makeText(this, "您沒(méi)有安裝 SkipDemo002!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
如果需要skipdemo002的桌面圖標(biāo)不顯示,則不設(shè)置skipdemo002的 mainfest.xml 中的 launcher;
否則,像一般 APP 一樣配置 mainfest.xml 文件.
跳轉(zhuǎn)系統(tǒng)應(yīng)用一般也是使用 componentName().
2.getPackageManager().getLaunchIntentForPackage()
Intent _Intent = getPackageManager().getLaunchIntentForPackage("com.semp.skipdemo002");
if (_Intent != null) {?
//可傳值
startActivity(_Intent);?
} else {
Toast.makeText(WorkProductActivity.this, "您沒(méi)有安裝skipdemo002",Toast.LENGTH_LONG).show();
}
使用 action.
?
posted on 2015-01-07 11:20 Semp 閱讀(...) 評(píng)論(...) 編輯 收藏轉(zhuǎn)載于:https://www.cnblogs.com/WongSuechang/p/4207971.html
總結(jié)
以上是生活随笔為你收集整理的Android工程开发笔记一的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 程序员福利各大平台免费接口,非常适用
- 下一篇: Android 网络通信架构学习