由网友(人未来,心己亡)分享简介:以下code是不工作的果冻豆(安卓4.1):following code is not working for Jelly Bean (Android 4.1):final ComponentName cn = new ComponentName("com.android.phone","com.android.p...
以下code是不工作的果冻豆(安卓4.1):
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);
而启动的设置,它doesn't什么,知道怎样解决呢?
Instead to start setting , it doesn´t nothing, any idea how to solve it?
下面是解决办法:
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);
相关推荐
最新文章