Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to return to home screen from Activity

I know Android will return to the home screen when I press the Home key, however, I want my imageButton to behave as the Home key, which can inform the home screen to the foreground.

How should I implement my onClickListener to accomplish this?

like image 298
user718146 Avatar asked May 05 '11 15:05

user718146


People also ask

How do I go back to previous activity?

Android activities are stored in the activity stack. Going back to a previous activity could mean two things. You opened the new activity from another activity with startActivityForResult. In that case you can just call the finishActivity() function from your code and it'll take you back to the previous activity.

How to get back to Home screen on android phone?

Gesture navigation: Swipe up from the bottom of the screen. 2-button navigation: Tap Home . 3-button navigation: Tap Home .


1 Answers

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    startActivity(intent);
like image 193
Alec B. Plumb Avatar answered Sep 30 '22 11:09

Alec B. Plumb