FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESETDeprecated so what should i use?
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
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; }
Documentation citation :
According to API 21, this is identical to the FLAG_ACTIVITY_NEW_DOCUMENT, which should be used instead.
Since both characters have the same numerical value ( 0x00080000), it doesn't really matter which one you are using regarding runtime behavior. If yours compileSdkVersionis 21 or higher, switch toFLAG_ACTIVITY_NEW_DOCUMENT
0x00080000
compileSdkVersion
FLAG_ACTIVITY_NEW_DOCUMENT
(Intent)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { i.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); }