val capExInputType : ToggleButton = view.findViewById(R.id.toggleCapEx)
Above is how i am setting the ToggleButton to a value.
properties[position].capEx = view.editupCapEx.text.toString().toDouble()
Above is where i initially save the data in SQL database
capExInputType.setOnCheckedChangeListener { _, isChecked ->
if (isChecked)
properties[position].capEx =
(properties[position].rent * 12) * (properties[position].capEx / 100)
else
properties[position].capEx =
properties[position].capEx
}
Then After the input is saved i check to see if the toggle button is on, if its on i want to run a math problem and then if it is off i want to just leave the value as is. Currently it just saves the value but will not run the math problem regardless of what i try. In this example i am updating a specific item that was already saved once within SQL databse. I am using Kotlin within Android Studios. I dont know if this is the best way to do what i want. Basically all i am after is that the user can either choose to input a flat dollar amount and save that flat dollar amount OR they can choose to save a percentage of another value as the same value that the flat dollar amount would be. Any help is greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire