1
What is the difference between the methods? in the case of super.onBackPressed() can only be used within the right onBackPressed() method?
1
What is the difference between the methods? in the case of super.onBackPressed() can only be used within the right onBackPressed() method?
2
When you call super.onBackPressed()
at all times within the onBackPressed()
means that you are assuming the default behavior of the button back
of the device, i.e., "back up" that terminates the activity.
The idea of making override of function onBackPressed()
is you can define the behavior you want when the user clicks the button back
device. If you call super.onBackPressed()
you’re maintaining the button’s behavior back
, even so you can add other behaviors like storing variables before closing the activity.
The finish()
(also) serves to finish the activity you are running at any time without using the button back
. You can even use another button in your app to finish the activity.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
What context and exactly do you want to do?
– Guilherme Bernal