• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Question about android hierarchy

Dear developers,


I have a question about the hierarchy of Android.

I have the following structure:

  • SplashScreen.java (LAUNCHER)
    • Menu.java (DEFAULT)
      • InstrumentList.java (DEFAULT)
        • Instrument.java (DEFAULT)
Okay, for this question it doesn't matter what I am creating but I have to tell you that I have 2 types of 'InstrumentList', and those are: "snare" and "wind".

Now, you have a list (depending on which button you pressed) everything works fine. That's not the problem. Now, when you press on a listitem (instrument) you get a detailed 'information package' of it. Off course you can go 'back'.

so: SplashScreen > Menu > InstrumentList > Instrument
and when you go back: Instrument > InstrumentList
and even further: InstrumentList > Menu

What I want to do is finish() the InstrumentList activity when you go back to Menu. But I don't want it to be finish()'ed when you go to to Instrument.
So when do I have to use the finish() function? In the onPause() part? No, because when you are in InstrumentList and go to Instrument, the InstrumentList is finish()'ed. And I don't want that.

So my question is, when you go back to the parent activity (Menu), is the child (InstrumentList) automatically finish()'ed? Or do I have to do this manually? The problem is that I don't want to have 20 activities open by accident (in child>child>child activities)

I hope that you guys understand what I want and that you can attempt to help me.


Kind regards, Jelmer
 
If I understand your question correctly you want to make sure when you use the back button the activity you are currently on is destroyed and cleaned up to prevent your from using too much memory. If this is your question then yes it should be. If you want to verify add a log to onDestroy to see it is called.
 
If I understand your question correctly you want to make sure when you use the back button the activity you are currently on is destroyed and cleaned up to prevent your from using too much memory. If this is your question then yes it should be. If you want to verify add a log to onDestroy to see it is called.

It is nessesery to close multi useage objects (the camera for instance)
Android system will do the rest
 
Back
Top Bottom