zoukankan      html  css  js  c++  java
  • singleTask, startActivityForResult不能共存的问题

    原因未知,设置了目标BActivity为singleTask后,在AActivity中调用BActivity,例如

    Intent intent = new Intent(this, BActivity.class);

    startActivityForResult(intent, 1);

    结果先会调用到  AActivity中的onActivityResult,而在BActivity设置setResult(Activity.RESULT_OL)后,AActivity的onActivityResult不会接受到通知。

    解决方案:设置BActivity为singleTop.

    Note that this method should only be used with Intent protocols that are defined to return a result. In other protocols (such as ACTION_MAIN or ACTION_VIEW), you may not get the result when you expect. For example, if the activity you are launching uses the singleTask launch mode, it will not run in your task and thus you will immediately receive a cancel result.

    http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)

  • 相关阅读:
    jquery插件layer
    获取订单的product_id 和订单的数量
    Python psutil模块
    Linuc bazaar命令
    分布式版本控制系统
    launchpad, jira, github
    C/C++ 经典面试题汇总
    Windows Cmder
    Reddit指南
    Linux xclip命令
  • 原文地址:https://www.cnblogs.com/lilihuang/p/2150409.html
Copyright © 2011-2022 走看看