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

c# - Move local mssql database to webhosted MYSQL -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

java - How to pass parameters between Request-Scoped Controllers? -