You can do this.

                float weight = Float.valueOf(txt_weight.getText().toString());
or this
                double weight = Double.valueOf(txt_weight.getText().toString());


On Mar 30, 8:52 pm, Kaiwan <[email protected]> wrote:
> Greetings All,
>
> Am an Android app dev newbie, so pl bear with this (possibly) stupid
> question.
> (Actually i did post it last night in reply to a similar qs but it
> does not seem to show up, so am re-posting as a new thread).
>
> Am developing an app, and a relatively small issue is driving me
> nuts.
> The app has an EditText widget. The user enters his/her weight in this
> control. So lets say the user enters "65.5" (kg). I can retrieve this
> value as a string (using txt_weight.getText().toString(); ).
> But, I want to use it in an arithmetic expression, hence I require to
> interpret it as a float.
> How exactly do I do this??
>
> Appreciate your help!
> TIA,
> kaiwan.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to