您好我想这个code。打开移动网络设置:
Hi I would like to open the mobile network settings with this code:
Intent intentSettings = new Intent();
intentSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intentSettings.setAction(Settings.ACTION_DATA_ROAMING_SETTINGS);
cont.startActivity(intentSettings);
但它给我这个错误。任何想法吗?
but it gives me this error. Any ideas anyone?
12-10 11:17:34.902: ERROR/AndroidRuntime(623): android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.settings.DATA_ROAMING_SETTINGS flags=0x4000000 }
感谢
要得到这个工作,改变你的意图创建以下code:
To get this working, change your intent creation to the following code:
Intent intent=new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
ComponentName cName = new ComponentName("com.android.phone","com.android.phone.Settings");
intent.setComponent(cName);
基本上Android清单需要一个组成部分过滤器。
Basically the android manifest requires a component filter.