Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes

How do you create a back button in the top left corner that allows you to go to the previous activity in android?

asked in CSC490_Spring2019 by (8 points)

2 Answers

+4 votes

Found an answer here at

Need to add these methods

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            return true;
    return super.onOptionsItemSelected(item);
public boolean onCreateOptionsMenu(Menu menu) {
    return true;

And put this line in the oncreate method

answered by (8 points)
0 votes

I would think just drag the button to the top?

answered by (8 points)