following code is not working for 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);
Instead to start setting , it doesn´t nothing, any idea how to solve it?
Here is solution:
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);
Thank you guys : )
try as:
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);
The code below is much more simple and tested on Gingerbread (2.3.7) and JB (4.1.2)
startActivityForResult(new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS), 0);
来源:https://stackoverflow.com/questions/11291387/android-mobile-network-settings-menu-jelly-bean