we know that there are flags which we can add to our intent using the addFlags() method in our java code. Is there any way we can add these flags in the manifest file itself instead of writing this in java code. I need to add REORDER_TO_FRONT flag for one of my activities in the manifest.
How to achieve this ?
To fix this problem, set the flags Intent. FLAG_ACTIVITY_NEW_TASK and Intent. FLAG_ACTIVITY_CLEAR_TASK to switch to an existing instance of the activity and clear any other activities on top of it: Intent intent = new Intent(context, TestActivity.
Use addFlags() so that you can add multiple number of Flags to Intent.
In the manifest file, you use the <intent-filter> tag to make intent to app components.
In Kotlin or is the replacement for the Java bitwise or | . If you need the option to add additional flags in other situations, add an optional param to the extension function.
In manifest file you can not add Intent flags.You need to set the flag in Intent which u pass to startActivity. Here is a sample:
Intent intent = new Intent(this, ActivityNameToLaunch.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With