Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-use previous activities?

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.

like image 228
Eno Avatar asked Feb 16 '10 22:02

Eno


People also ask

What are examples of repurpose?

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.

How do you reuse and repurpose?

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.

How can a student reuse?

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.


3 Answers

You can control some aspects of this with android:launchMode on the activity.

like image 152
Erich Douglass Avatar answered Oct 22 '22 02:10

Erich Douglass


Programmatically try following:

    Intent intent = new Intent(contextActivity, NextActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    contextActivity.startActivity(intent);
like image 39
mizim Avatar answered Oct 22 '22 00:10

mizim


You can specify information regarding that in the android manifest. See activity element documentation. I believe that launchmode might control what you are after.

like image 2
Cheryl Simon Avatar answered Oct 22 '22 01:10

Cheryl Simon