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 7852327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:23:36+00:00 2026-06-02T19:23:36+00:00

I am trying to draw paths on google maps using android i found this

  • 0

I am trying to draw paths on google maps using android i found this code online but i get some errors i can’t fixed it.It created class for points and class for RoadProvider but i get confused between the built in class points and points he has created it.Here it is the errors

 Description    Resource    Path    Location    Type
mDescription cannot be resolved or is not a field   RoadProvider.java   /sbn/src/sbn/project/gp line 103    Java Problem
mIconUrl cannot be resolved or is not a field   RoadProvider.java   /sbn/src/sbn/project/gp line 109    Java Problem
mLatitude cannot be resolved or is not a field  RoadProvider.java   /sbn/src/sbn/project/gp line 117    Java Problem
mLongitude cannot be resolved or is not a field RoadProvider.java   /sbn/src/sbn/project/gp line 118    Java Problem
mName cannot be resolved or is not a field  RoadProvider.java   /sbn/src/sbn/project/gp line 90 Java Problem
The method addPoint(Point[]) in the type KMLHandler is not applicable for the arguments (Point[])   RoadProvider.java   /sbn/src/sbn/project/gp line 68 Java Problem
The method addPoint(Point[]) in the type KMLHandler is not applicable for the arguments (Point[])   RoadProvider.java   /sbn/src/sbn/project/gp line 69 Java Problem

ana here it is the code

package sbn.project.gp;

public class Point {

    String mName;
    String mDescription;
    String mIconUrl;
    double mLatitude;
    double mLongitude;
}

And this the RoadProvider class

public class RoadProvider {

        public static Road getRoute(InputStream is) {
            KMLHandler handler = new KMLHandler();
            try {
                    SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
                    parser.parse(is, handler);
            } catch (ParserConfigurationException e) {
                    e.printStackTrace();
            } catch (SAXException e) {
                    e.printStackTrace();
            } catch (IOException e) {
                    e.printStackTrace();
            }
            return handler.mRoad;
    }

    public static String getUrl(double fromLat, double fromLon, double toLat,
                    double toLon) {// connect to map web service
            StringBuffer urlString = new StringBuffer();
            urlString.append("http://maps.google.com/maps?f=d&hl=en");
            urlString.append("&saddr=");// from
            urlString.append(Double.toString(fromLat));
            urlString.append(",");
            urlString.append(Double.toString(fromLon));
            urlString.append("&daddr=");// to
            urlString.append(Double.toString(toLat));
            urlString.append(",");
            urlString.append(Double.toString(toLon));
            urlString.append("&ie=UTF8&0&om=0&output=kml");
            return urlString.toString();
    }
    }

    class KMLHandler extends DefaultHandler {
    Road mRoad;
    boolean isPlacemark;
    boolean isRoute;
    boolean isItemIcon;
    private Stack mCurrentElement = new Stack();
    private String mString;

    public KMLHandler() {
            mRoad = new Road();
    }

    public void startElement(String uri, String localName, String name,
                    Attributes attributes) throws SAXException {
            mCurrentElement.push(localName);
            if (localName.equalsIgnoreCase("Placemark")) {
                    isPlacemark = true;

                    mRoad.mPoints=addPoint(mRoad.mPoints);//there is an error here
                    mRoad.mPoints = addPoint(mRoad.mPoints);//there is an error here
            } else if (localName.equalsIgnoreCase("ItemIcon")) {
                    if (isPlacemark)
                            isItemIcon = true;
            }
            mString = new String();
    }

    public void characters(char[] ch, int start, int length)
                    throws SAXException {
            String chars = new String(ch, start, length).trim();
            mString = mString.concat(chars);
    }

    public void endElement(String uri, String localName, String name)
                    throws SAXException {
            if (mString.length() > 0) {
                    if (localName.equalsIgnoreCase("name")) {
                            if (isPlacemark) {
                                    isRoute = mString.equalsIgnoreCase("Route");
                                    if (!isRoute) {
                                            mRoad.mPoints[mRoad.mPoints.length - 1].mName = mString; //there is an error here  
                                    }
                            } else {
                                    mRoad.mName = mString;
                            }
                    } else if (localName.equalsIgnoreCase("color") && !isPlacemark) {
                            mRoad.mColor = Integer.parseInt(mString, 16);
                    } else if (localName.equalsIgnoreCase("width") && !isPlacemark) {
                            mRoad.mWidth = Integer.parseInt(mString);
                    } else if (localName.equalsIgnoreCase("description")) {
                            if (isPlacemark) {
                                    String description = cleanup(mString);
                                    if (!isRoute)
                                            mRoad.mPoints[mRoad.mPoints.length - 1].mDescription = description;//there is an error here 
                                    else
                                            mRoad.mDescription = description;//there is an error here 
                            }
                    } else if (localName.equalsIgnoreCase("href")) {
                            if (isItemIcon) {
                                    mRoad.mPoints[mRoad.mPoints.length - 1].mIconUrl = mString;
                            }
                    } else if (localName.equalsIgnoreCase("coordinates")) {
                            if (isPlacemark) {
                                    if (!isRoute) {
                                            String[] xyParsed = split(mString, ",");
                                            double lon = Double.parseDouble(xyParsed[0]);
                                            double lat = Double.parseDouble(xyParsed[1]);
                                            mRoad.mPoints[mRoad.mPoints.length - 1].mLatitude = lat;
                                            mRoad.mPoints[mRoad.mPoints.length - 1].mLongitude = lon;
                                    } else {
                                            String[] coodrinatesParsed = split(mString, " ");
                                            int lenNew = coodrinatesParsed.length;
                                            int lenOld = mRoad.mRoute.length;
                                            double[][] temp = new double[lenOld + lenNew][2];
                                            for (int i = 0; i < lenOld; i++) {
                                                    temp[i] = mRoad.mRoute[i];
                                            }
                                            for (int i = 0; i < lenNew; i++) {
                                                    String[] xyParsed = split(coodrinatesParsed[i], ",");
                                                    for (int j = 0; j < 2 && j < xyParsed.length; j++)
                                                            temp[lenOld + i][j] = Double
                                                                            .parseDouble(xyParsed[j]);
                                            }
                                            mRoad.mRoute = temp;
                                    }
                            }
                    }
            }
            mCurrentElement.pop();
            if (localName.equalsIgnoreCase("Placemark")) {
                    isPlacemark = false;
                    if (isRoute)
                            isRoute = false;
            } else if (localName.equalsIgnoreCase("ItemIcon")) {
                    if (isItemIcon)
                            isItemIcon = false;
            }


        return value;
    }

    public Point[] addPoint(Point[] Points) {
            Point[] result = new Point[Points.length + 1];
            for (int i = 0; i < Points.length; i++)
            {  result[i] = Points[i];}
            result[Points.length] = new Point();
            return result;
    }
  • 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-02T19:23:38+00:00Added an answer on June 2, 2026 at 7:23 pm

    Refer this link to draw driving path in your application. You just need to add the four classes present in the link in your project and call the below lines when you need to display the route.

    SharedData data = SharedData.getInstance();
    data.setAPIKEY("0RUTLH7cqd6yrZ0FdS0NfQMO3lioiCbnH-BpNQQ");//set your map key here
    data.setSrc_lat(17);//set your src lat
    data.setSrc_lng(78);//set your src lng
    data.setDest_lat(18);//set your dest lat
    data.setDest_lng(77);//set your dest lng
    startActivity(new Intent(YourActivity.this,RoutePath.class));//add RoutePath in your manifeast file
    

    //Also add the permission to your manifeast file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to draw a series of rectangles using OpenGL but some of
I'm trying to draw a polygon using c# and directx All I get is
I am trying to use google maps API V3 to draw a line from
The task is, to draw paths at runtime on custom maps which im using
I am trying to draw path between two points on google map using url
Why when I want to draw a polyline using Google maps V3.0 (JavaScript API)
I'm trying to draw some simples lines with the iPhone/Touch SDK. I'd like to
I'm trying to draw a vertical scrollbar for my G15 applet, but am having
I'm trying to draw over the whole screen by using the desktop canvas and
I am trying to draw a textured cube using just 8 vertices and one

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.