When the soft keyboard is active, the back button is switched to this one
What is the name of the button? And what is the method that is called after pressing it?
When the soft keyboard is active, the back button is switched to this one
What is the name of the button? And what is the method that is called after pressing it?
I assume that you are referring to the downward-pointing triangle on the left side of the navigation bar.
What is the name of the button?
BACK.
And what is the method that is called after pressing it?
In this case, nothing. The input method editor will be closed.
If there is no input method editor open, onBackPressed()
will be called on the foreground activity.
It's the same button, it just changes it's shape. Usually it will change it's function from going back to te previous activity to closing the keyboard.
The method it calls usually is onBackPressed()
but in this case the keyboard will consume it's call, it will go to the onEditorAction()
inside OnEditorActionListener
, if you want to know how to intercept the action usually consumed by the keyboard you can read more in Intercept back button from soft keyboard
this one is simply a Hardware back button and on some devices its inside screen as you shown in the screenshot. Its called Back Button
.
you can override onBackPressed
method in your Activity
which will be called when this button is pressed.
@override
public void onBackPressed() {
// .... Do your task here
super.onBackPressed();
}