i succeeded in adding a back button to the action bar of an activity but when clicked nothing happens here is the code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
all i want to know is how to make the button clickable (to go back) thanks.
First of all you should ask Google, it's your friend. Questions like that will be mark down and probably closed like duplicate.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
//do what you want
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}