2012-04-24 23 views
0

我有一個調用另一個應用程序的單個部件,這裏是代碼的最重要的部分:查找類組件名稱類使用Android中

final Intent intent = new Intent(Intent.ACTION_MAIN, null); 
intent.addCategory(Intent.CATEGORY_LAUNCHER); 
final ComponentName cn = new ComponentName("com.android.settings", 
"com.android.settings.wifi.WifiSettings"); 
intent.setComponent(cn); 
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
ctxt.startActivity(intent); 

的重要組成部分,是

final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings"); 

這在android中調用wifi設置,但是我在網站中發現了這些代碼,我想知道如何在系統中調用數據漫遊和其他設置,在哪裏可以看到?

+0

難道我的答案的工作? – 2013-11-16 11:09:56

回答

1

com.android.settings是包的名稱。如果你去here你可以找到這個包中的所有可用設置。漫遊設置在包com.android.phone - 見here

編輯:it appears使用軟件包名稱不便攜。最好的辦法是使用:

startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS)); 

意圖的名單是在Settings class

may also need添加FLAG_ACTIVITY_NEW_TASK到你的意圖

+0

感謝您的幫助 – fabiobh 2013-05-06 14:12:24