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
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
Post a Comment