[Solved] How to create logic with String updated when he is changed


You always add your profit to hardcoded 5000 instead of saving your current amount and adding it to that.

Try that:

// Define this as global variable
int cash = 5000

// When win:
String text = spinnerData.getSelectedItem().toString();  //i get data from spinner
int temp = Integer.parseInt(text); //then parse it to Int
int temp2 = temp * 2; //profit 100% so *2
cash += temp2 //Add the amount to cash
btnCashCurrency.setText(cash + " $");

0

solved How to create logic with String updated when he is changed