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

  • Home
  • SEARCH
  • 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 8307689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:34:48+00:00 2026-06-08T18:34:48+00:00

I’m new in android and I’m testing an application that provides the road path

  • 0

I’m new in android and I’m testing an application that provides the road path in android. But I have many errors in here (like shown below).

    public class MapRouteActivity extends MapActivity {

        LinearLayout linearLayout;
        MapView mapView;
        private Road mRoad;

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                mapView = (MapView) findViewById(R.id.mapview);
                mapView.setBuiltInZoomControls(true);

                new Thread() {
                        @Override
                        public void run() {
                                double fromLat = 49.85, fromLon = 24.016667, toLat = 50.45, toLon = 30.523333;
                                String url = RoadProvider
                                                .getUrl(fromLat, fromLon, toLat, toLon);
                                InputStream is = getConnection(url);
                                mRoad = RoadProvider.getRoute(is);
                                mHandler.sendEmptyMessage(0);
                        }
                }.start();
        }

        Handler mHandler = new Handler() {
                public void handleMessage(android.os.Message msg) {
                        TextView textView = (TextView) findViewById(R.id.description);
                        textView.setText(mRoad.mName + " " + mRoad.mDescription);
                        MapOverlay mapOverlay = new MapOverlay(mRoad, mapView);
                        List<Overlay> listOfOverlays = mapView.getOverlays();
                        listOfOverlays.clear();
                        listOfOverlays.add(mapOverlay);
                        mapView.invalidate();
                };
        };

        private InputStream getConnection(String url) {
                InputStream is = null;
                try {
                        URLConnection conn = new URL(url).openConnection();
                        is = conn.getInputStream();
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                }
                return is;
        }

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

class MapOverlay extends com.google.android.maps.Overlay {
        Road mRoad;
        ArrayList<GeoPoint> mPoints;

        public MapOverlay(Road road, MapView mv) {
                mRoad = road;
                if (road.mRoute.length > 0) {
                        mPoints = new ArrayList<GeoPoint>();
                        for (int i = 0; i < road.mRoute.length; i++) {
                                mPoints.add(new GeoPoint((int) (road.mRoute[i][1] * 1000000),
                                                (int) (road.mRoute[i][0] * 1000000)));
                        }
                        int moveToLat = (mPoints.get(0).getLatitudeE6() + (mPoints.get(
                                        mPoints.size() - 1).getLatitudeE6() - mPoints.get(0)
                                        .getLatitudeE6()) / 2);
                        int moveToLong = (mPoints.get(0).getLongitudeE6() + (mPoints.get(
                                        mPoints.size() - 1).getLongitudeE6() - mPoints.get(0)
                                        .getLongitudeE6()) / 2);
                        GeoPoint moveTo = new GeoPoint(moveToLat, moveToLong);

                        MapController mapController = mv.getController();
                        mapController.animateTo(moveTo);
                        mapController.setZoom(7);
                }
        }

        @Override
        public boolean draw(Canvas canvas, MapView mv, boolean shadow, long when) {
                super.draw(canvas, mv, shadow);
                drawPath(mv, canvas);
                return true;
        }

        public void drawPath(MapView mv, Canvas canvas) {
                int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
                Paint paint = new Paint();
                paint.setColor(Color.GREEN);
                paint.setStyle(Paint.Style.STROKE);
                paint.setStrokeWidth(3);
                for (int i = 0; i < mPoints.size(); i++) {
                        Point point = new Point();
                        mv.getProjection().toPixels(mPoints.get(i), point);
                        x2 = point.x;
                        y2 = point.y;
                        if (i > 0) {
                                canvas.drawLine(x1, y1, x2, y2, paint);
                        }
                        x1 = x2;
                        y1 = y2;
                }
        }
}

while i lunch this code i have all these error like bellow :

07-30 14:03:08.969: W/dalvikvm(6934): Unable to resolve superclass of Lcom/test/MapRouteActivity; (17)
07-30 14:03:08.969: W/dalvikvm(6934): Link of class 'Lcom/test/MapRouteActivity;' failed
07-30 14:03:08.969: W/dalvikvm(6934): threadid=1: thread exiting with uncaught exception (group=0x2aac87c8)
07-30 14:03:08.979: E/AndroidRuntime(6934): FATAL EXCEPTION: main
07-30 14:03:08.979: E/AndroidRuntime(6934): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.test/com.test.MapRouteActivity}: java.lang.ClassNotFoundException: com.test.MapRouteActivity in loader dalvik.system.PathClassLoader[/data/app/com.test-1.apk]
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.os.Looper.loop(Looper.java:123)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at java.lang.reflect.Method.invokeNative(Native Method)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at java.lang.reflect.Method.invoke(Method.java:521)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at dalvik.system.NativeStart.main(Native Method)
07-30 14:03:08.979: E/AndroidRuntime(6934): Caused by: java.lang.ClassNotFoundException: com.test.MapRouteActivity in loader dalvik.system.PathClassLoader[/data/app/com.test-1.apk]
07-30 14:03:08.979: E/AndroidRuntime(6934):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-30 14:03:08.979: E/AndroidRuntime(6934):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-30 14:03:08.979: E/AndroidRuntime(6934):     ... 11 more
  • 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-08T18:34:49+00:00Added an answer on June 8, 2026 at 6:34 pm

    Use Below Code Snippet

    private List<Overlay> mapOverlays;
    
    private Projection projection;  
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    linearLayout = (LinearLayout) findViewById(R.id.zoomview);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    
    mapOverlays = mapView.getOverlays();        
    projection = mapView.getProjection();
    mapOverlays.add(new MyOverlay());        
    
    }
    
    @Override
    protected boolean isRouteDisplayed() {
    return false;
    
    }
    
    class MyOverlay extends Overlay{
    
    public MyOverlay(){
    
    }   
    
    public void draw(Canvas canvas, MapView mapv, boolean shadow){
    super.draw(canvas, mapv, shadow);
    
    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);
    
    GeoPoint gP1 = new GeoPoint(19240000,-99120000);
    GeoPoint gP2 = new GeoPoint(37423157, -122085008);
    
    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);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have two tables with like below codes: Table: Accounts id | username |
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.