日志如下:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.WIRELESS_SETTINGS }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1835)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1556)
at android.app.Activity.startActivityForResult(Activity.java:3854)
at android.app.Activity.startActivityForResult(Activity.java:3805)
at android.app.Activity.startActivity(Activity.java:4135)
at android.app.Activity.startActivity(Activity.java:4103)
at android.view.View.performClick(View.java:4908)
at android.view.View$PerformClick.run(View.java:20382)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5692)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
还有类似的异常,都是调用系统服务,比如相机,联系人。修改如下:
Intent intent=new Intent(Settings.ACTION_WIRELESS_SETTINGS);
if(intent.resolveActivity(getPackageManager())!=null) {
startActivity(intent);
}else {
}
网友评论