public static boolean isVisible(@NonNull final Activity activity) {
        final Rect visibleBounds = new Rect();
        final View root = activity.findViewById(android.R.id.content);
        root.getWindowVisibleDisplayFrame(visibleBounds);

        final int heightDiff = root.getHeight() - visibleBounds.height();
        final int marginOfError = ViewUtils.dpToPixel(50);
        return heightDiff > marginOfError;
    }
Class for hiding/showing the soft keyboard on Android.
main/src/main/java/cgeo/geocaching/activity/Keyboard.java