I´m currently working on a currency converter project for school. I have an array with currencies (USD,EUR etc) and one with values (6.54, 9.56 etc).
I have two spinners and one EditText and you choose From unit in one spinner and To unit in the other. Then it should consider the amount in editText and show the "live" result in textView. If you change spinners or editText the value in textview should update directly.
Let's say that the value inserted in editText is 10.0, and we want to convert it from USD to EUR, the calculation will look like this: 10.0*6.54/9.56=
But I can't figure out how to add the editText in to the calculation. And I also get an error message saying I have an empty String
Doesn't the error message make it plain? NumberFormatException(←link) and “empty string”. It means you cannot get a number out of your text box until you put some content in it.
I suggest you use a Scanner. Did you know that you can create a Scanner from a text box? Well, actually, you can't, but you can do the next best thing: create a Scanner dealing with the contents of a text box:-Beware: if you enter "123.456 Adde Berg" in the text box, it will happily give you a return value of a BigDecimal containing 123.456.