I'm making a simple dice rolling app as a way to learn some basics about Android Studio.
The method called onClick is shown below:
public void setSide(View v){
Button b = (Button)v;
sides = Integer.getInteger(b.getText().toString(),-1);
}
It seems to be passing -1 to sides no matter what, and all the buttons calling this method have only numbers in their strings (ex: "2", "20", "100", etc). Is there a way to fix this?
EDIT: I should probably explain that sides is local, and is used in another method, doRoll which is called the the Click of another button. This method sets the text of a textview to roll(sides), a method which returns a number from 1-sides if sides > 1, otherwise it returns -999. I have sides initialized to 20, and when I press the rollBtn before anything else, it works fine.