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);

  • 相关阅读:
    Oracle11g 安装 -Linux
    oracle 11g安装-window
    将本地文件上传到github
    highcharts实现画辅助线功能并删除
    eclipse中一个项目引用另一个项目的方法
    Kubernetes label简单使用
    spark 报错 InvalidClassException: no valid constructor
    NFS服务配置 Linux
    Ubuntu-Server18.04开启无线网卡并配置静态ip
    Ubuntu18.04安装mysql并配置远程访问
  • 原文地址:https://www.cnblogs.com/rocksmall/p/12858649.html
Copyright © 2011-2022 走看看