Indeed, you can override the back button in Android. This can be achieved by overriding the onKeyDown function, as follows:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// Hide keyboard and activate previous activity
return false;
}
return super.onKeyDown(keyCode, event);
}
(Although I do admit, I've never tested this to see if it would work whilst the keyboard is open...)
Hell, if this doesn't work you could even go about doing something slightly "hacky", like this:
boolean opened = true;
public void setListenerToRootView(){
final View activityRootView = getWindow().getDecorView().findViewById(android.R.id.content);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > 100 )
opened = true;
else if(opened == true)
opened = false;
}
});
}
This approach obviously may cause errors if they have a floating keyboard or something specific, but you can handle it as necessary.
Note: None of this solves the fact that the arrow points downward. I don't think you can really modify this, though you can at least modify its behavior, by navigating to the previous activity whenever the keyboard has been removed.