android-cn / android-discuss

Android 问题交流讨论坛, 微信公众号:codekk, 网站:
https://github.com/android-cn/android-discuss/issues
Apache License 2.0
4.08k stars 537 forks source link

android 魅族 4.4.4 怎么打开 android.settings.WIRELESS_SETTINGS ? #220

Open PineyZhang opened 9 years ago

PineyZhang commented 9 years ago

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.WIRELESS_SETTINGS } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1745) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1463) at android.app.Activity.startActivityForResult(Activity.java:3502) at android.app.Activity.startActivityForResult(Activity.java:3463) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) at android.app.Activity.startActivity(Activity.java:3705) at android.app.Activity.startActivity(Activity.java:3673) at com.foorich.auscashier.activitys.BaseActivity.onSettingNetworkManager(BaseActivity.java:486) at com.foorich.auscashier.activitys.BaseActivity.access$3(BaseActivity.java:475) at com.foorich.auscashier.activitys.BaseActivity$7.onConfirmClick(BaseActivity.java:459) at com.foorich.auscashier.utils.DialogUtils$3.onClick(DialogUtils.java:238) at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:358) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5054) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method)

I've tried this way, also not line!Please answer???

Intent Intent = null; If (Build. VERSION. SDK_INT > 10) { Intent = new intent (android. The provider. Settings. ACTION_WIRELESS_SETTINGS); } else { Intent = new intent (); The ComponentName component = new the ComponentName ("com. Android. settings", "com. Android. settings. WirelessSettings"); Intent. SetComponent (component); Intent. SetAction ("android. Intent. action. VIEW"); } this. startActivity (intent);

echojiangyq commented 9 years ago

trt this: startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));