Heres the dilemma: I am showing a screen with 3 input fields and 2 buttons inside of a tab(there are 3 tabs total, and they are on the bottom of the screen). the 2 buttons
Working solution for me -
ViewTreeObserver treeObserver = getViewTreeObserver();
if (treeObserver != null)
treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int pHeight = getResources().getDisplayMetrics().heightPixels;
Rect visRect = new Rect();
viewGroup.getWindowVisibleDisplayFrame(visRect);
boolean keyboardVisible;
int keyboardHeight= pHeight-currentHeight;
if (keyboardHeight > (MIN_KEYBOARD_HEIGHT*pHeight))
{
TGVLog.d(debugTag, "keyboardVisible-- "+true);
keyboardVisible = true;
}
else
{
TGVLog.d(debugTag, "keyboardVisible-- "+false);
keyboardVisible = false;
}
}
});