Android : Cannot cast from View to Button

Posted by Mick on Stack Overflow See other posts from Stack Overflow or by Mick
Published on 2010-05-10T19:55:30Z Indexed on 2010/05/10 20:04 UTC
Read the original article Hit count: 1308

Filed under:
|
|
|
|

I just started working with the Android, but seem to have come across a problem that I simply can't find the answer to. I get the error "Cannot cast from View to Button" on this line :

Button myButton = (Button)findViewById(R.id.my_button);

I've tried many different things to get it going, and I've searched for the answer, but for some reason it just refuses to work right. If anybody could point me in the right direction it'd be most appreciated.

Thank you in advance.

© Stack Overflow or respective owner

Related posts about android

Related posts about java