Using Home icon as a navigation back button

I’d like to enable clicking on the home icon. This click would take user one screen back. Maybe it should take user back to front screen.  For now, act as a back button.

Nothing more simple!

1. @Override

public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(, menu);
// enable home icon to be a button
ActionBar actionBar = getActionBar();
return true;




public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {

return true;



Simple. Little arrow to the left is drawn next to the icon. I didn’t have to create an image.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s