zoukankan      html  css  js  c++  java
  • 跳转手机网络设置页面 崩溃了怎么办呢

    java.lang.RuntimeException: Unable to resume activity {com.huichenghe.xinlvshuju/com.huichenghe.xinlvshuju.mainpack.MainActivity}: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3139)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3170)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2516)
        at android.app.ActivityThread.access$900(ActivityThread.java:165)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:150)
        at android.app.ActivityThread.main(ActivityThread.java:5621)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
    Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
        at android.app.ContextImpl.startActivity(ContextImpl.java:757)
        at android.app.ContextImpl.startActivity(ContextImpl.java:737)
        at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)
        at com.huichenghe.xinlvshuju.zhy.utils.utils.NetWorkUtil.openSettingNetActivity(NetWorkUtil.java:102)
        at com.huichenghe.xinlvshuju.mainpack.MainActivity.onResume(MainActivity.java:2433)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1266)
        at android.app.Activity.performResume(Activity.java:6446)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3129)
        ... 10 more

    解决办法:

    启动之前设置flagintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

  • 相关阅读:
    linux 开机启动设置
    Ubuntu安装Oracle时出现乱码,及其他安装错误
    ubuntu 设置DNS
    opencv cuda TK1 TX1 兼容设置
    int to string
    post文件的html
    vc 获得调用者的模块名称
    dlib landmark+人面识别
    android破解
    jquery $(document).ready() 与window.onload的区别
  • 原文地址:https://www.cnblogs.com/rocksmall/p/12858649.html
Copyright © 2011-2022 走看看