java - Android: Cannot execute method with TextView -
this question has answer here:
i following beginner's android development course on udacity , have seemed come across simple error, though cannot life of me figure out or how search it.
there number increment , decrement button on sides change it. problem comes either when call displayquantity method or when tries set text of quantitytextview. value of quantity change, app closes before changes on screen.
public void increment (view view){ quantity = quantity + 1; displayquantity(quantity); } public void decrement (view view){ quantity = quantity - 1; displayquantity(quantity); } private void displayquantity(int quantity) { textview quantitytextview = (textview) findviewbyid(r.id.quantity_text_view); quantitytextview.settext(quantity); }
change to
quantitytextview.settext(integer.tostring(quantity));
textview.settext()
overloaded. version takes integer expects resource identifier string resource (e.g. r.string.something
), value passing doesn't correspond such resource.
Comments
Post a Comment