I am trying to use the code depicted in this thread How to check visibility of software keyboard in Android?
As you can see the author is using a class which inherits from LinearLayout. And later initialize the new instance as follows:
LinearLayoutThatDetectsSoftKeyboard mainLayout = (LinearLayoutThatDetectsSoftKeyboard)findViewById(R.id.main);
Is that possible?I am getting a ClassCastException. And as explains here to do a downcasting you first need to reference the parent to the child.
Yes thats possible. Did you declare the custom LinearLayout correctly in the main.xml layout?
Something like: