美文网首页
线上bug修复之No Activity found to han

线上bug修复之No Activity found to han

作者: shada | 来源:发表于2016-10-13 17:21 被阅读312次

    日志如下:

    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 {
        
    }
    

    相关文章

      网友评论

          本文标题:线上bug修复之No Activity found to han

          本文链接:https://www.haomeiwen.com/subject/ywnwyttx.html