Issue

The logic continues as Home Screen->Screen1->Screen2->Screen3->HomeScreen.
1.On Pressing Home Button of Screen3 it will return to Home Screen. Again On Pressing Enter Button of Home Screen it will goto Screen1then Screen2and Screen3.
2.Again now I'm on Home Screen. If I Press back button it has to goto home screen of phone. Instead, it's going in reverse order on pressing back key. I dont want to call finish() activity in each screen.
Give me a solution!
Solution
In Screen 3, override onBackPressed() and start Activity of HomeScreen with Clear Top Flag.
Here is the Sample
@Override
protected void onBackPressed()
{
Intent i = new Intent(Screen3.this,HomeScreen.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
Answered By - TNR
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.