sau mã không làm việc cho Jelly Bean (Android 4.1):Android - menu cài đặt mạng di động (Jelly Bean)
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);
Thay vào đó để bắt đầu cài đặt, nó doesn't gì, bất kỳ ý tưởng làm thế nào để giải quyết nó ?
Dưới đây là giải pháp:
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);
Cảm ơn các bạn:)
thử sau khi thêm FLAG_A CTIVITY_NEW_TASK cờ –