Java inheritance in Android -
Java inheritance in Android -
i trying utilize code depicted in thread android: software keyboard shown?
as can see author using class inherits linearlayout. , later initialize new instance follows:
linearlayoutthatdetectssoftkeyboard mainlayout = (linearlayoutthatdetectssoftkeyboard)findviewbyid(r.id.main);
is possible?i getting classcastexception. , explains here downcasting first need reference parent child.
yes thats possible. did declare custom linearlayout correctly in main.xml layout? like:
<com.yourpackage.linearlayoutthatdetectssoftkeyboard></com.yourpackage.linearlayoutthatdetectssoftkeyboard>
java android inheritance casting
Comments
Post a Comment