2014-01-31 37 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