I was wondering about something very basic but that I haven’t been able to figure out. I’ve read the similar questions, but they don’t particularly answer my question.
Let’s say I have a string. I want to convert it into a double. Now I see that there is a function known as parseDouble in java.lang.Double. However, how do I call it? The string is in my Android strings.xml file if that’s any help.
Thanks.
To get the String from your xml file in an Activity, use
You convert it to a double in the way OscarRyz said, although if you don’t want a Double object you can do
You can also do it all in one step: