Android 应用间的集成
生活随笔
收集整理的這篇文章主要介紹了
Android 应用间的集成
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
第一次在手機上安裝wsm tools時發(fā)現(xiàn)wsm只是個簡單的集成框架,需要用其中的工具還需要單獨安裝,而安裝一個工具以后發(fā)現(xiàn)圖標(biāo)沒有顯示,感覺很神奇,最近工作需要,也要做android應(yīng)用間的集成,研究了下,其實很簡單。只需要提供要被集成的應(yīng)用package、activity名稱即可
例如,在當(dāng)前應(yīng)用中集成另外一個應(yīng)用,像在同一應(yīng)用中通過通過intent啟動:
1 public class MainActivity extends Activity { 2 @Override 3 protected void onCreate(Bundle savedInstanceState) { 4 super.onCreate(savedInstanceState); 5 setContentView(R.layout.main); 6 7 Intent intent = new Intent(); 8 //該應(yīng)用的包名和要啟動的主Activity 9 ComponentName componentname = new ComponentName( "com.xxxx.xxxx", "com.xxxx.xxxx.App"); 10 intent.setComponent(componentname); 11 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 12 intent.putExtra("paramName", "paramValue"); 13 startActivity(intent); 14 15 } 16 }如果想讓被集成的應(yīng)用圖標(biāo)隱藏,需要在AndroidManifest.xml中進行設(shè)置,修改的android.intent.category.LAUNCHER為android.intent.category.DEFAULT
即可實現(xiàn)圖標(biāo)的隱藏:
<activity android:name=".MainActivity"android:process="com.baixd.framework"android:theme="@android:style/Theme.NoTitleBar"android:label="@string/app_name"><intent-filter><action android:name="android.intent.action.MAIN" /><!--<category android:name="android.intent.category.LAUNCHER" />--><category android:name="android.intent.category.DEFAULT" /></intent-filter> </activity>?
轉(zhuǎn)載于:https://www.cnblogs.com/blacksonny/p/3983874.html
總結(jié)
以上是生活随笔為你收集整理的Android 应用间的集成的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何使用firebug
- 下一篇: 微信开发--one.微信平台验证