简体   繁体   中英

“Back” doesn't work when start the mapview activity

why my back button doesn't function in google map activity ? already include:

@Override
public void onBackPressed()  {return;}

but still doesn't work.

You need this:

@Override
public void onBackPressed() {
    super.onBackPressed();
}

Or this pre API level 5:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    if(keyCode == KeyEvent.KEYCODE_BACK) {
        // your implementation here
        // finish(); - to exit the Activity
        return true; // shows you consumed the event with your implementation
    }
    return super.onKeyDown(keyCode, event);
}

write

super.onBackPressed();

or

this.finish();

instead of return;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM