I usually navigate between the Activities using Intents
Pictorial representation looks as below::
In Activity - A .......... There is a next button to go to activity B
Photos.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent PhotoIntent=new Intent(a.this,b.class);
startActivity(PhotoIntent);
}
});
In Activity - B .......... There is a next button to go to again activity C
Map.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent PhotoIntent=new Intent(b.this,c.class);
startActivity(PhotoIntent);
}
});
- Now in Activity C .... there is only one back button
- If I use it i similarly to above code I can't go to two activities depending on the navigation i came from
Suppose i came from A
to C
------ when i use Back
button in C
go to A
Again when came from B
to C
----- when i use Back
button in C
go to B
There is only one back
button
in Activity C
[Edit]
Its like Say i came from Activity
A to Activity C
----- When i USE the only back button in Activity C
it should go to activity A
&
For the same scenario if i came from Activity B to Activity C - - - - When i USE the only back button in Activity C
it should go to activity B
------- I am trying to relate a switching case kind of mechanism for Back button in ActivityC
How to Achieve this
Hope i am clear