2014-01-31 36 views
0

當我啓動系統意圖時,Android設備打開錯誤的設置頁面。我試圖用下面的代碼打開數據漫遊設置頁面,但設備打開了數據漫遊選項不存在的設置頁面。當我啓動系統意圖時,設備打開錯誤的設置頁面

if (bv < Build.VERSION_CODES.JELLY_BEAN) { 
    Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS); 
    ComponentName cName = new ComponentName("com.android.phone", "com.android.phone.Settings"); 
    intent.setComponent(cName); 
    startActivity(intent); 
} else { 
    Intent intent = new Intent(); 
    intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS); 
    startActivity(intent); 
} 
+0

Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(「com.android.phone」,「com.android.phone.NetworkSetting」); startActivity(intent); – Meenal

+0

使用此意圖只需將設置更改爲網絡設置 – Meenal

回答

2

試試這個

Intent intent = new Intent(); 
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS); 
startActivity(intent); 

它的工作在我的情況。這個東西在android 4.1.2中爲我工作

+0

設備操作系統是2.3。 – User10001

+0

@ashish閱讀更多關於舊版本支持非常好所以SO帖子[這裏](http://stackoverflow.com/questions/4407818/error-opening-mobile-network-settings-menu) –

+1

問題是,Android系統處理意圖但打開錯誤的活動。 – User10001