Android使用Intent啟動其他非系統(tǒng)應(yīng)用程序的方法
本文實例講述了Android使用Intent啟動其他非系統(tǒng)應(yīng)用程序的方法。分享給大家供大家參考,具體如下:
android應(yīng)用程序內(nèi)部通過Intent來實現(xiàn)Activity間的跳轉(zhuǎn)。也知道通過Intent調(diào)用系統(tǒng)程序。但若想在應(yīng)用程序A內(nèi)開啟應(yīng)用程序B(前提是A、B均已安裝),該如何去實現(xiàn)?
記錄下實現(xiàn)過程。
在應(yīng)用程序A內(nèi)添加如下代碼:
Intent i = new Intent(); i.setClassName("com.example.a", "com.example.a.AActivity"); startActivity(i);
或者
Intent i = new Intent(); ComponentName cn = new ComponentName("com.example.b", "com.example.b.BActivity"); i.setComponent(cn); startActivity(i);
注:
com.example.a是應(yīng)用程序B的包名
com.example.a.AActivity是應(yīng)用程序B你將要啟動的Activtiy
這樣就可以O(shè)K了。
希望本文所述對大家Android程序設(shè)計有所幫助。
相關(guān)文章
Android LayoutInflater深入分析及應(yīng)用
這篇文章主要介紹了Android LayoutInflater分析的相關(guān)資料,需要的朋友可以參考下2017-02-02Android getJSONObject與optJSONObject的區(qū)別結(jié)合源碼分析
這篇文章主要介紹了Android getJSONObject與optJSONObject的區(qū)別,結(jié)合源碼分析的相關(guān)資料,需要的朋友可以參考下2017-02-02