以下代码不适用于Jelly Bean(Android 4.1):
final ComponentName cn = new ComponentName("com.android.phone","com.android.phone.Settings");
final Intent intent=new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
相反,开始设置,它不是什么,任何想法如何解决它?
这是解决方案:
final ComponentName cn = new ComponentName("com.android.phone","com.android.phone.MobileNetworkSettings");
final Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
intent.addCategory(Intent.ACTION_MAIN);
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
谢谢你们:)
答案 0 :(得分:5)
尝试:
final Intent intent=new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final ComponentName cn = new ComponentName("com.android.phone","com.android.phone.Settings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
答案 1 :(得分:0)
下面的代码更简单,并在Gingerbread(2.3.7)和JB(4.1.2)
上进行了测试 startActivityForResult(new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS), 0);