Code example for ActionBarActivity

Methods: finish, startActivity

0
		switch (item.getItemId()) {
		case android.R.id.home:
			Intent intent = new Intent(this, MainActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
			                Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
 
			finish(); 
			return true; 
 
		default: 
			return super.onOptionsItemSelected(item);
		} 
	} 
}