android toolbar: how to go back to previous activity if back arrow is pressed

Viewed 22946

I have an activity called Place

I come to Place activity from its previous activity called City.

I have added back button to the toolbar in Place activity using the following code:

    Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true)

I want to set the back button to go back to City activity

But City activity needs some parameters to be passed to it.

So how to tell the back button to go to City activity, without need to pass the parameters to it.

5 Answers
Related