I have an application that when a button is clicked it changes the content view, but when I press the back button, it closes the activity. How do I change what the back button does. In this case it will be the back button changing the layout again.
Thanks
You must override
onBackPressed()in your activity.The
onBackPressedmethod is called when the back Button is pressed, for that, you must change the content of this method by overriding it.