I can't print out the strings after I try to convert them using either of these two routines because it crashes.

double satlon = Double.valueOf(SatLon_Str).doubleValue();
double satlon = Double.parseDouble();

(Using a Float before was sloppiness on my part. However, even when I use a Double it still crashes.)

String SatLon_Str = satlonEditText.getText().toString();
Double doubleValue = 0.0;
Scanner scanner = new Scanner(SatLon_Str);
while (scanner.hasNextDouble())
{
    doubleValue = scanner.nextDouble();
}
double satlon = doubleValue;
String output = "SatLon_Str: " + SatLon_Str + " Length:" + SatLon_Str.length() + String.format(" Converted: %.5f", satlon);
ResultText.setText(output);

Below is the output to the preceding code. When I enter 123, I get 123.00000. When I enter 123.0, I get 0.00000.

SatLon_Str: 123 Length:3 Converted: 123.00000
SatLon_Str: 123.0 Length:5 Converted: 0.00000

At 09:28 AM 5/12/2010, you wrote:
On Wed, May 12, 2010 at 11:08 AM, T1000 <<mailto:t1...@zando.dyndns.org>t1...@zando.dyndns.org> wrote:
What am I doing wrong?


Print out the values of the strings just before you try to convert them, then the value of what you get.
Why are you using Float to get a double value?

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
<http://sites.google.com/site/rezmobileapps/treking>http://sites.google.com/site/rezmobileapps/treking

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
<http://stackoverflow.com/questions/tagged/android>http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/android-beginners?hl=en>http://groups.google.com/group/android-beginners?hl=en



--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to