Axbor Axrorov
Axbor Axrorov

Reputation: 2806

cannot find symbol variable FLAG_ACTIVITY_CLEAR_TASK

After updating support version to 27.0.0 compiler giving error

cannot find symbol variable FLAG_ACTIVITY_CLEAR_TASK.

Is this variable removed? What use instead?

code example:

 Intent intent = new Intent(SetNewPasswordActivity.this, SignInActivity.class);
 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);

Upvotes: 6

Views: 3205

Answers (5)

dbog
dbog

Reputation: 166

IntentCompat.FLAG_ACTIVITY_CLEAR_TASK is deprecated thus please use Intent.FLAG_ACTIVITY_CLEAR_TASK directly.

This flag can only be used in conjunction with #FLAG_ACTIVITY_NEW_TASK.

Upvotes: 2

Vishal Yadav
Vishal Yadav

Reputation: 1024

  • Remove this line

IntentCompat.FLAG_ACTIVITY_CLEAR_TASK

  • add this

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

Upvotes: 0

AskNilesh
AskNilesh

Reputation: 69709

use this

 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

instead of this

 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);

Upvotes: 1

Vivek Mishra
Vivek Mishra

Reputation: 5705

IntentCompat doesn't have any flag like FLAG_ACTIVITY_CLEAR_TASK.

You should use Intent instead.

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

cannot find symbol variable FLAG_ACTIVITY_CLEAR_TASK

You should use Intent.FLAG_ACTIVITY_CLEAR_TASK.

If set in an Intent passed to Context.startActivity(), this flag will cause any existing task that would be associated with the activity to be cleared before the activity is started.

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

Upvotes: 15

Related Questions