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

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -