my working code to go back screen.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Toast.makeText(getApplicationContext(), "Home Clicked",
Toast.LENGTH_LONG).show();
// go to previous activity
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}