Is there some way to know that virtual keyboard is made hidden by user during run time. Before tagging me duplicate question, first understand my question because it seems like duplicate and I also found lots of question with related topic. But not found any answer.
My problem is during some event to occur like say orientation change, I need to know whether user has minimized the keyboard or not.So that I take action accordingly. I tried to be very specific to question even any explanation feel free to ask. Any help will appreciated .Thanks in advance My Try
final View activityRootView = findViewById(R.id.ll_main_root);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > 100) { // if more than 100 pixels, its probably a keyboard...
Toast.makeText(MainActivity.instance, "KeyBoarad" + value, Toast.LENGTH_LONG).show();
}
}
});