java - First time with Android Studio, having one small surprise on "Error:(24cannot find symbol class button -


i following course , did best. when try run code says

"error:(24, 19) error: cannot find symbol class button"

does mean have not defined find button ?

it looks

http://imgur.com/a/vlq7i

i appreciate feedback ! :d

in below line trying cast variable name(button), cannot done.

button = (button) findviewbyid(r.id.button); 

should be:

button = (button) findviewbyid(r.id.button); 

when casting remember add data type(in case class name) inside parantheses(). otherwise syntax error that.

why, syntax error?

findviewbyid(int id); returns view of id have specified. , button variable data-type button. avoid uncompatible error need cast match both side.

also read: why have cast button?, this question , this.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -