Skip to content Skip to sidebar Skip to footer

Number Picker Gets Stuck When Set At 0

Here's the code I have so far: final ImageView plus_button = (ImageView) view.findViewById(R.id.plus_sign); final ImageView minus_button = (ImageView) view

Solution 1:

1) it starts the way it does because you didn't set anything for it at first. You could do something like num.setText(Integer.toString(counter [0])); right after calling it by its id. Notice that you only set some text to num when you increase or decrease

2) I believe it's related with the fact that you substract no matter what. You should have the subtract operation inside your second if statement. The way you have it right now it allows you to go as far as you want before zero, but it won't show because your if evaluates if it's greater than or equal to zero, and because it's not, it doesn't show

3) Not sure what you mean, but you could do num.getText().toString() and parse it to an integer or keep it like that. That will get you what's on your num textview when you call it

Post a Comment for "Number Picker Gets Stuck When Set At 0"