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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:44:14+00:00 2026-05-31T03:44:14+00:00

I’ve been trying to work this piece of code for a week now. The

  • 0

I’ve been trying to work this piece of code for a week now. The route does not come up. My code is below.

I am trying to draw a route between two geopoints – the location which I’m retrieving from a web service.

My log doesn’t show any error.

public class TesterGTC extends MapActivity {

    private static final String NAMESPACE = "http://tempuri.org/";
    private static final String URL = "http://10.0.2.2:2488/Service1.asmx";
    private static final String METHOD_NAME1 = "lastKnownLocationAllValues";
    private static final String SOAP_ACTION = NAMESPACE + METHOD_NAME1;
    private List<Overlay> mapOverlays;
    private Projection projection;  
    MapView mapView;
    double latitude;
    double longitude;
    double endlat;
    double endlong;
    GeoPoint geoPoint;
    MapController myMC;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE); // Suppress title bar to give more space
        setContentView(R.layout.googletrackingclient);


        final String orderID = GoogleTrackingMenu.epcID;
        final String vehicleid = GoogleTrackingMenu.vehicleid;
        Thread t = new Thread(new Runnable() {
            public void run() {
                String u = orderID;
                String v = vehicleid;

                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);

                PropertyInfo propInfo = new PropertyInfo();
                propInfo.name = "OID";
                propInfo.type = PropertyInfo.STRING_CLASS;
                request.addProperty(propInfo, u);

                PropertyInfo propInfo2 = new PropertyInfo();
                propInfo2.name = "vehicleID";
                propInfo2.type = PropertyInfo.STRING_CLASS;
                request.addProperty(propInfo2, v);

                final TextView textview = (TextView) findViewById(R.id.id1);
                final TextView myLoc = (TextView) findViewById(R.id.id2);
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                        SoapEnvelope.VER11);
                envelope.dotNet = true;

                envelope.setOutputSoapObject(request);

                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

                androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

                final ArrayList<EPCISGPSResult> resultList = new ArrayList<EPCISGPSResult>();
                try {

                    androidHttpTransport.call(SOAP_ACTION, envelope);
                    final SoapObject resultRequestSOAP = (SoapObject) envelope
                            .getResponse();
                    final int resultInt = resultRequestSOAP.getPropertyCount();
                    for (int i = 0; i < resultInt; i++) {
                        SoapObject resultRequest = (SoapObject) resultRequestSOAP
                                .getProperty(i);
                        String vehicleID = resultRequest.getProperty("vehicleID").toString();
                        String driverName = resultRequest.getProperty("driverName").toString();
                        String latitude = resultRequest.getProperty("latitude").toString();
                        String longitude = resultRequest.getProperty("longitude").toString();
                        String startVenue = resultRequest.getProperty("startVenue").toString();
                        String destination = resultRequest.getProperty("destination").toString();
                        String dateReceived = resultRequest.getProperty("dateReceived").toString();
                        String utc = resultRequest.getProperty("utc").toString();
                        String orderID = resultRequest.getProperty("orderID").toString();
                        EPCISGPSResult e = new EPCISGPSResult(vehicleID,driverName, latitude, longitude, startVenue,destination, dateReceived, utc, orderID);
                        resultList.add(e);

                    }

                    latitude = Double.parseDouble(resultList.get(0).getLatitude());
                    longitude = Double.parseDouble(resultList.get(0).getLongitude());
                    endlat = Double.parseDouble(resultList.get(resultList.size()-1).getLatitude());
                    endlong = Double.parseDouble(resultList.get(resultList.size()-1).getLongitude());
                     int beglat = (int)latitude* 1000000;
                     int endinglat = (int)endlat* 1000000;
                     int beglong = (int)longitude* 1000000;
                     int endinglong = (int)endlong* 1000000;
                     final GeoPoint gP1 = new GeoPoint(beglat, beglong);
                     final GeoPoint gP2 = new GeoPoint(endinglat, endinglong);



        TesterGTC.this.runOnUiThread(new Runnable() {
            public void run() {
                int pointer = 0;
                pointer = 1;
                 TextView tview = (TextView) findViewById(R.id.id1);

                 tview.setText("before map");
                mapView = (MapView) findViewById(R.id.myGMap);
                mapView.setBuiltInZoomControls(true);
                mapView.setSatellite(true);

                myMC = mapView.getController();
                myMC.setZoom(15);
                int color = Color.RED;
                mapOverlays = mapView.getOverlays();        
                projection = mapView.getProjection();

                TextView txxview = (TextView) findViewById(R.id.id2);

                 txxview.setText("after map");
                MyOverlay newO = new MyOverlay(gP1, gP2, color);

               /* TextView textview = (TextView) findViewById(R.id.id1);

                textview.setText("This is happening");*/

                mapOverlays.add(newO);





            }       });

    } 
    catch (final Exception e) {
        TesterGTC.this.runOnUiThread(new Runnable() {
            public void run() {
                TextView textview = (TextView) findViewById(R.id.id1);

                textview.setText("Your error is: " + e.getMessage().toString());
            }
        });

    } finally {

    }
            }
        });
        t.start();
    }
    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }

    class MyOverlay extends Overlay{
        GeoPoint gp1;
        GeoPoint gp2;
        int color;

        public MyOverlay(GeoPoint gp1, GeoPoint gp2, int color){
            this.gp1 = gp1;
            this.gp2 = gp2;
            this.color = color;

        }   

        public void draw(Canvas canvas, MapView mapView, boolean shadow, GeoPoint gP1 , GeoPoint gP2){
            super.draw(canvas, mapView, shadow);


            TextView textview = (TextView) findViewById(R.id.id1);

            textview.setText("This is ALSO happening");

            Paint   mPaint = new Paint();
            mPaint.setDither(true);
            mPaint.setColor(Color.RED);
            mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
            mPaint.setStrokeJoin(Paint.Join.ROUND);
            mPaint.setStrokeCap(Paint.Cap.ROUND);
            mPaint.setStrokeWidth(2);

            Point p1 = new Point();
            Point p2 = new Point();
            Path path = new Path();

            projection.toPixels(gP1, p1);
            projection.toPixels(gP2, p2);

            path.moveTo(p2.x, p2.y);
            path.lineTo(p1.x,p1.y);

            canvas.drawPath(path, mPaint);
        }

    }
}
  • 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-05-31T03:44:16+00:00Added an answer on May 31, 2026 at 3:44 am

    Here saddr = source & daddr = destination location.

    public void showDirections(View view) {
            final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?" + "saddr="+ latitude + "," + longitude + "&daddr=" + latitude + "," + longitude));
            intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
            startActivity(intent);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.