我尝试从教程的setFlags中使用此标志,但已弃用,我该怎么办 [英] I tried using this Flag in setFlags from tutorial but its deprecated, what do i do

查看:122
本文介绍了我尝试从教程的setFlags中使用此标志,但已弃用,我该怎么办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET 已过时;所以我应该使用什么?

FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET is deprecated; so what should I use?

private Intent createShareForecastIntent() {

    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, mforecastStr + FORECAST_SHARE_HASHTAG);
    return shareIntent;


}


推荐答案

引用文档


从API 21开始,其性能与应使用FLAG_ACTIVITY_NEW_DOCUMENT相同。

As of API 21 this performs identically to FLAG_ACTIVITY_NEW_DOCUMENT which should be used instead of this.

由于两个符号的数值相同( 0x00080000 ),所以就运行时行为而言,使用哪一个并不重要。如果您的 compileSdkVersion 为21或更高,请切换到 FLAG_ACTIVITY_NEW_DOCUMENT

Since both symbols have the same numerical value (0x00080000), it does not really matter which one you use in terms of runtime behavior. If your compileSdkVersion is 21 or higher, switch to FLAG_ACTIVITY_NEW_DOCUMENT

这篇关于我尝试从教程的setFlags中使用此标志,但已弃用,我该怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆