Starting from the Launcher activity i need a way to know what level (hierarchy) the app is at.
For example image the user is in a shopping app & takes the following path:
- Main Activity ---> 2. list of shoes to buy ----> 3. shopping cart ---> 4. checkout
so checkout would be level 4. and when the user is just lookign at shoes to buy that would be level 2. I need this for reporting (but thats too much info i think). I just need to know what level/section im at in the app. How can i design something to track this in the activity life cycle ?
update: i have a static variable called level and i extended off Application in my app so i can reset it to 0 each time the activity starts. then in my activities onstart and onstop im adjusting the level but i dont know if this takes care of all scenarios.
@Override
public void onStart() {
// TODO Auto-generated method stub
super.onStart();
sLevel++;
}
@Override
public void onStop() {
// TODO Auto-generated method stub
super.onStop();
sLevel--;
}
but its not working. All my activities ( and there are at least 50) extend from an abstract class called baseActivity. in Base Activity is where i'd like to main the level. the end goal is to be able to track where the user came from. I need to report the path the end user took to arrive at the activity