I have activities that are create and launched from menu options. However Ive noticed that this may mean that sometimes there are two or more copies of the same activity. So Im wondering if there's a way to see if another activity is already instantiated and then have the application switch to it or create a new one if its not instantiated.
Examples of repurposing include using tires as boat fenders and steel drums or plastic drums as feeding troughs and/or composting bins. Incinerator and power plant exhaust stack fly-ash is used extensively as an additive to concrete, providing increased strength.
A slightly clearer definition found on this site is “to reuse the (waste) material in its original state, but to a different purpose.” Whereas you would reuse a product for its original purpose in a new place or way, to repurpose would be to find a new purpose for an already existing material.
Never throw away an old book - donate it to a library, a recycling centre or your school. Reuse old curtains and sheets as cleaning rags. Reuse old glass containers by washing them out and using them for storage. Reuse your old toothbrush and use it to clean hard to reach areas.
You can control some aspects of this with android:launchMode
on the activity.
Programmatically try following:
Intent intent = new Intent(contextActivity, NextActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
contextActivity.startActivity(intent);
You can specify information regarding that in the android manifest. See activity element documentation. I believe that launchmode might control what you are after.
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