Hi Kostya,

The picture is clearer now after your explanation.
I have an application server generating Latitude and Longitude in XML
and I pullpurse it in my program to compare to current location.

So I need to convert the Lat and Lon to Long so I can do a distant to
current location calculation.
The Integer is a XML value in meter to indicate whether I am in the
specific range and is also a string value after the pullpurser.

What do I need to do in conversion so I do not have any round/
trancated value?

Many thanks,
CJ


On Jan 1, 9:37 pm, Kostya Vasilyev <[email protected]> wrote:
> "1.3001505" is not a valid Integer.
>
> Either:
>
> - fix (round, truncate, etc.) the value to be an Integer when you're
> putting it into the array;
>
> - use Real.parseFloat / Double.parseDouble / NumberFormat to parse a
> floating-point value;
>
> - use a strongly-typed array (ArrayList<float>, ArrayList<Integer> etc.)
> instead of an array of strings to avoid conversions altogether.
>
> -- Kosyta
>
> 01.01.2011 16:21, Mystique пишет:
>
>
>
>
>
>
>
>
>
> > Yes, I want to transfer the value of StringArray tmp2 in position 1
> > so I do this String tmp3 = tmp2.get(1)...
>
> > Debugger said:
> > 01-01 13:15:38.378: ERROR/AndroidRuntime(2893): Caused by:
> > java.lang.NumberFormatException: 1.3001505
>
> > On Jan 1, 9:09 pm, Kostya Vasilyev<[email protected]>  wrote:
> >> Use the debugger, Luke :)
>
> >> Check the value of tmp3 just before you call Integer.parseInt.
>
> >> I am assuming you actually added a value to tmp2, so when you call
> >> get(1) there is something there.
>
> >> -- Kostya
>
> >> 01.01.2011 15:38, Mystique пишет:
>
> >>> Hi, please help me out.
> >>> == This is ok ==
> >>> String tmp1 = "123"
> >>> int seed = Integer.parseInt(tmp1);
> >>> == This is not ok ==
> >>> ArrayList<String>    tmp2 = new ArrayList<String>();
> >>> String tmp3 = tmp2.get(1);
> >>> //Added some value to the ArrayList, Toast value of tmp3 and sees the
> >>> correct value
> >>> int seed = Integer.parseInt(tmp3);
> >>> // I get runtime error here, what is wrong?
> >>> Happy new year.
> >> --
> >> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >> --http://kmansoft.wordpress.com
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to