在一個app中打開另外一個app中的一個actiivty

最近碰到這個知識點,以前學的記不清了,記錄下。
步驟如下:
1. 目標app中:允許另外進程啓動此頁面。

    <activity android:name=".TestActivity"
            android:exported="true"
            />
  1. 本app中:
Intent intent = new Intent();    
//intent.setClassName(包名,頁面名)
intent.setClassName("com.wy.test","com.wy.test.TestActivity");
startActivity(intent);

tips:A應用打開B應用的一個頁面,B應用的進程也相應啓動了。 B應用的這個頁面會保留app中的特性。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章