Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:53:56+00:00 2026-06-04T12:53:56+00:00

Having this problem with my android app I struggled with this for some time

  • 0

Having this problem with my android app

I struggled with this for some time now, and went through alot of similar threads but never really solved it. I haven’t managed to recreate the crash my self but i get crash-reports from other users

Here is a crash-report:

java.lang.NumberFormatException: -
at org.apache.harmony.luni.util.FloatingPointParser.initialParse(FloatingPointParser.java:149)
at org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser.java:281)
at java.lang.Double.parseDouble(Double.java:318)
at polis.koll.HelloMapView.loadallmarkers(HelloMapView.java:665)
at polis.koll.HelloMapView.access$10(HelloMapView.java:611)
at polis.koll.HelloMapView$6.run(HelloMapView.java:587)
at java.lang.Thread.run(Thread.java:1027)

And here is my code, the last line seem to be to one generating the error

        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser sp = spf.newSAXParser();
        XMLReader xr = sp.getXMLReader();

        /** Send URL to parse XML Tags */
        URL sourceUrl = new URL(
        "http://www.mysite.com/xml.php");

        /** Create handler to handle XML Tags ( extends DefaultHandler ) */
        MyXMLHandler myXMLHandler = new MyXMLHandler();
        xr.setContentHandler(myXMLHandler);
        xr.parse(new InputSource(sourceUrl.openStream()));
        } catch (Exception e) {
        //System.out.println("XML Pasing Excpetion = " + e);
        }

        sitesList = MyXMLHandler.sitesList;
        gotsnr = "";
        gotmarkers = 0;
        LocationOverlay locationOverlay = new LocationOverlay(mapView, getResources().getDrawable(R.drawable.polis), mContext);

        if (sitesList !=null){
        for (int i = 0; i < sitesList.getSnr().size(); i++) {
        gotsnr = sitesList.getSnr().get(i);
        gotmarkers = (i);
        //if (gotsnr !=""){ 
        if (sitesList.getLat().get(i).equalsIgnoreCase("")||sitesList.getLat().get(i).equalsIgnoreCase(null)){
            // Empty, do nothing

        } else{

        GeoPoint point = new GeoPoint( new Double(Double.parseDouble(sitesList.getLat().get(i)) * 1e6).intValue() , new Double(Double.parseDouble(sitesList.getLng().get(i)) * 1e6).intValue());

* Edit below in replie to @kcoppock

Could this do the trick?

double dlat = 0;
double dlng = 0;

            if (sitesList.getLat().get(i) !=null && !"".equals(sitesList.getLat().get(i)) ){
                    try {
                       dlat = Double.parseDouble(sitesList.getLat().get(i));
                    } catch (NumberFormatException e) {
                       //System.out.println(e.getMessage());
                    }
                }
            if (sitesList.getLng().get(i) !=null && !"".equals(sitesList.getLng().get(i)) ){
                try {
                    dlng = Double.parseDouble(sitesList.getLng().get(i));
                } catch (NumberFormatException e) {
                   //System.out.println(e.getMessage());
                }
            }

            if (dlat !=0  && dlng !=0){

            GeoPoint point = new GeoPoint( new Double(dlat * 1e6).intValue() , new Double(dlng * 1e6).intValue());    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:53:57+00:00Added an answer on June 4, 2026 at 12:53 pm

    You’re not handling the NumberFormatException in the first place, which is bad practice even if you weren’t having crashes. Split that line up, parse the doubles first, and be sure to catch the NumberFormatException and handle it appropriately (e.g. throw an alert dialog, place a default value, etc.) in case for some reason the value in getLat() or getLon() are not parseable, which is what is apparently happening in these cases.

    double lat = 0, lng = 0;
    String sLat = sitesList.getLat().get(i);
    String sLng = sitesList.getLng().get(i);
    GeoPoint point;
    
    try {
        lat = Double.parseDouble(sLat);
        lng = Double.parseDouble(sLng);
    
        //If it gets here, they parsed successfully
        point = new GeoPoint((int)(lat * 1e6), (int)(lng * 1e6));
    } catch (NumberFormatException e) {
        Log.e("TAG", "Couldn't parse latitude and/or longitude");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problem with developing an android app. Everything runs smooth until a
I'm having trouble putting this problem into searchable terms. I'm working on an Android
I'm having this problem with the grails liferay-plugin: localhost_liferay_portlet_WEB_INF_grails_app_views_test_view_gsp: 17: expecting anything but ''\n'';
We are having this problem with a controller right now; the controller looks like
I've been having this problem where anytime I send a 0xA through an RS-232
I have been having this problem for a few days now, and really cant
I'm having some trouble searching a SQLite database in my Android app. I use
I am having another problem with my android app which I can't find an
I am having a problem with GSON in my Android app. JSON Input [
I was working through a tutorial at http://fszlin.blogspot.com/2010/05/comsuming-wcf-services-with-android.html and am having a problem. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.