is there a default back key(on device) listener in android?

后端 未结 5 392
慢半拍i
慢半拍i 2020-12-03 03:33

I am having two activities A and B. when i click the button in A that will shows B. when i click the Button in B it backs to A. i had set the overridePendingTransition metho

5条回答
  •  既然无缘
    2020-12-03 04:06

    For Android 2.0 and later, there is a specific method in the Activity class:

    @Override  
    public void onBackPressed() {
        super.onBackPressed();   
        // Do extra stuff here
    }
    

提交回复
热议问题