【发布时间】:2012-07-02 17:34:42
【问题描述】:
以下代码不适用于 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);
谢谢你们:)
【问题讨论】:
-
添加FLAG_ACTIVITY_NEW_TASK标志后尝试
标签: android networking settings android-4.2-jelly-bean