【问题标题】:Why the error "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag" happens only on some devices?为什么“从 Activity 上下文外部调用 startActivity() 需要 FLAG_ACTIVITY_NEW_TASK 标志”错误仅在某些设备上发生?
【发布时间】:2017-12-09 16:02:16
【问题描述】:

我收到了有关 Firebase 的崩溃报告和消息

从 Activity 上下文之外调用 startActivity() 需要 FLAG_ACTIVITY_NEW_TASK 标志。

此错误发生在搭载 Android 19 的三星 GT-I9500 上。我无法在搭载 Android Oreo (27) 的 Google Pixel 上重现该错误。

我知道如何设置标志,但我很想知道为什么这个错误只发生在某些版本的 Android 上。

这是我开始活动的方式:

    context.getApplicationContext().startActivity(intent);

【问题讨论】:

    标签: android android-intent android-activity


    【解决方案1】:

    我很想知道为什么这个错误只发生在某些版本的 Android 上。

    因为一个错误。请参阅this issuethis issue

    【讨论】:

    • 哦,谢谢,我也对这个问题很困惑。
    猜你喜欢
    • 1970-01-01
    • 2018-06-20
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2019-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多