Android - 移动网络设置菜单(Jelly Bean)

标签 android networking settings android-4.2-jelly-bean

以下代码不适用于 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);

谢谢你们:)

最佳答案

尝试:

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);

关于Android - 移动网络设置菜单(Jelly Bean),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11291387/

相关文章:

networking - TCP 是在每个数据包上发送 SYN/ACK 还是仅在第一个连接上发送?

java - NIO连接断开时未获取readyKey

android - 系统设置下缺少蓝牙

c# - 如何根据构建更新设置?

android - Gradle 属性中的引用属性

java - Spinner 对象引用问题?

elasticsearch - 无论如何,是否有阻止访问Elasticsearch内置API(例如/_nodes)的信息? ,/_ cluster,/_ cat等?

java - 如何在 ListFragment 中制作一个可点击的对象,它也覆盖了 onListItemClick

android - 无法在 android studio 上运行 App

c# - 如何解决需要完全控制/所有者权限的 LocalFileSettingsProvider