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(R.menu.menu_drill, menu);
// enable home icon to be a button
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
return true;
2.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
}
Simple. Little arrow to the left is drawn next to the icon. I didn’t have to create an image.