1

当我试图在我的android应用程序中加载起点和终点之间的goodle-map根方向时,我得到下面的错误是错误日志,下面给出了我的代码a。

谢谢。

class MapOverlay extends com.google.android.maps.Overlay {
    Road mRoad;
    Boolean toastindex=true;
    ArrayList<GeoPoint> mPoints;
    MapRouteActActivity c;
    public MapOverlay(Road road, MapView mv,MapRouteActActivity c) {
        mRoad = road;
        this.c = c;
        if (road.mRoute.length > 0) {

            mPoints = new ArrayList<GeoPoint>();
            System.out.println("===MAP Points===" + mPoints);
            for (int i = 0; i < road.mRoute.length; i++) {

                System.out.println("===road.mRoute.length===" + road.mRoute.length);
                mPoints.add(new GeoPoint((int) (road.mRoute[i][1] * 1000000),(int) (road.mRoute[i][0] * 1000000)));
                System.out.println("===++++MAP Points++++===" + mPoints);
            }
            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(12);
        }
    }

    @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);
        try {
            //cd: for (int i = 0; i < mPoints.size(); i++) {
             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;
            }
        } catch (Exception e) {
            // TODO: handle exception
            if (toastindex==true) {
                Toast  toast;
                toast=Toast.makeText(c, "Google map not avaliable now ,please come back later", Toast.LENGTH_SHORT);
                toast.show();
                toastindex=false;
            }
            c.finish();
        }
    }
}




  09-24 13:05:03.828: I/System.out(10427): in checkinternet()
09-24 13:05:03.838: I/System.out(10427): Connected to the internet
09-24 13:05:03.848: W/audio_hw_primary(87): get audio.routing failed
09-24 13:05:03.858: D/ViewRootImpl(10427): pckname = com.bookacab
09-24 13:05:03.878: I/System.out(290): [INFO:83399783]: LogSource: Running flush
09-24 13:05:03.878: I/System.out(290): [INFO:83399784]: LogSource: Sending payload [bytes=272]
09-24 13:05:04.078: I/System.out(290): [INFO:83399985]: LogSource: Response [http=200,length=208]
09-24 13:05:04.078: I/System.out(290): [INFO:83399986]: LogSource: Read id 63, status code 200
09-24 13:05:04.098: I/System.out(290): [INFO:83400008]: LogSource: Running flush
09-24 13:05:04.098: I/System.out(290): [INFO:83400009]: LogSource: Sending payload [bytes=272]
09-24 13:05:04.858: I/System.out(290): [INFO:83400765]: LogSource: Response [http=200,length=208]
09-24 13:05:04.858: I/System.out(290): [INFO:83400766]: LogSource: Read id 64, status code 200
09-24 13:05:04.878: I/System.out(290): [INFO:83400785]: LogSource: Running flush
09-24 13:05:04.878: I/System.out(290): [INFO:83400787]: LogSource: Sending payload [bytes=247]
09-24 13:05:04.968: I/wpa_supplicant(414): [CTRL_IFACE]SIGNAL_POLL
09-24 13:05:05.808: I/System.out(290): [INFO:83401717]: LogSource: Response [http=200,length=209]
09-24 13:05:05.808: I/System.out(290): [INFO:83401718]: LogSource: Read id 65, status code 200
09-24 13:05:05.828: I/System.out(290): [INFO:83401738]: LogSource: Running flush
09-24 13:05:05.828: I/System.out(290): [INFO:83401739]: LogSource: Sending payload [bytes=247]
09-24 13:05:05.878: D/dalvikvm(290): GC_CONCURRENT freed 464K, 10% free 7153K/7879K, paused 2ms+2ms
09-24 13:05:05.998: I/System.out(290): [INFO:83401908]: LogSource: Response [http=200,length=209]
09-24 13:05:05.998: I/System.out(290): [INFO:83401908]: LogSource: Read id 66, status code 200
09-24 13:05:06.008: I/System.out(10427): =====c_srclat======12.8871752
09-24 13:05:06.008: I/System.out(10427): =====c_srclog======77.6001091
09-24 13:05:06.008: I/System.out(10427): =====c_deslat======12.9151013
09-24 13:05:06.008: I/System.out(10427): =====c_deslog======77.6127996
09-24 13:05:06.008: I/ActivityManager(147): START {cmp=com.bookacab/.MapRouteActActivity (has extras)} from pid 10427
09-24 13:05:06.068: E/ActivityThread(10427): Performing pause of activity that is not resumed: {com.bookacab/com.bookacab.NewCabtype}
09-24 13:05:06.068: E/ActivityThread(10427): java.lang.RuntimeException: Performing pause of activity that is not resumed: {com.bookacab/com.bookacab.NewCabtype}
09-24 13:05:06.068: E/ActivityThread(10427):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2674)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2662)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2640)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.app.ActivityThread.access$800(ActivityThread.java:123)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1154)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.os.Looper.loop(Looper.java:137)
09-24 13:05:06.068: E/ActivityThread(10427):    at android.app.ActivityThread.main(ActivityThread.java:4424)
09-24 13:05:06.068: E/ActivityThread(10427):    at java.lang.reflect.Method.invokeNative(Native Method)
09-24 13:05:06.068: E/ActivityThread(10427):    at java.lang.reflect.Method.invoke(Method.java:511)
09-24 13:05:06.068: E/ActivityThread(10427):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-24 13:05:06.068: E/ActivityThread(10427):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-24 13:05:06.068: E/ActivityThread(10427):    at dalvik.system.NativeStart.main(Native Method)
09-24 13:05:06.098: W/MapActivity(10427): Recycling dispatcher android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher@410c4368
09-24 13:05:06.108: V/MapActivity(10427): Recycling map object.
09-24 13:05:06.168: I/System.out(10427):  MURALI: srclat=====12.8871752
09-24 13:05:06.168: I/System.out(10427):  MURALI:   =====77.6001091
09-24 13:05:06.168: I/System.out(10427):  MURALI: deslat=====12.9151013
09-24 13:05:06.168: I/System.out(10427):  MURALI: deslog=====77.6127996
09-24 13:05:06.168: I/System.out(10427):  MURALI: paddress=====2nd Main Rd,Bangalore,Karnataka 560076
09-24 13:05:06.168: I/System.out(10427):  MURALI: daddress=====BTM 2nd Stage
09-24 13:05:06.188: D/dalvikvm(10427): GC_CONCURRENT freed 332K, 7% free 8703K/9287K, paused 2ms+12ms
09-24 13:05:06.208: W/CursorWrapperInner(10427): Cursor finalized without prior close()
09-24 13:05:06.208: W/CursorWrapperInner(10427): Cursor finalized without prior close()
09-24 13:05:06.218: I/System.out(10427): -----------------urlString.toString()------------http://maps.google.com/maps?f=d&hl=en&saddr=12.8871752,77.6001091&daddr=12.9151013,77.6127996&ie=UTF8&0&om=0&output=kml
09-24 13:05:06.218: I/System.out(10427): MURALI: ENTRY - getConnection 
09-24 13:05:06.218: I/System.out(10427): MURALI: passed url is: http://maps.google.com/maps?f=d&hl=en&saddr=12.8871752,77.6001091&daddr=12.9151013,77.6127996&ie=UTF8&0&om=0&output=kml
09-24 13:05:06.218: I/System.out(10427): MURALI: after openConnection conn = libcore.net.http.HttpURLConnectionImpl:http://maps.google.com/maps?f=d&hl=en&saddr=12.8871752,77.6001091&daddr=12.9151013,77.6127996&ie=UTF8&0&om=0&output=kml
09-24 13:05:06.218: D/ViewRootImpl(10427): pckname = com.bookacab
09-24 13:05:06.268: V/TabletStatusBar(214): setLightsOn(true)
09-24 13:05:06.278: I/MapActivity(10427): Handling network change notification:CONNECTED
09-24 13:05:06.278: E/MapActivity(10427): Couldn't get connection factory client
09-24 13:05:06.318: I/ActivityManager(147): Displayed com.bookacab/.MapRouteActActivity: +247ms
09-24 13:05:06.508: I/System.out(10427): MURALI: after getInputStream() ************* 
09-24 13:05:06.508: I/System.out(10427): EXIT: getConnection 
09-24 13:05:06.518: I/System.out(10427): MURALI: inputStream is: libcore.net.http.ChunkedInputStream@411ee898
09-24 13:05:06.518: I/System.out(10427): MURALI: After getConnection libcore.net.http.ChunkedInputStream@411ee898
09-24 13:05:06.518: W/System.err(10427): org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 801: not well-formed (invalid token)
09-24 13:05:06.518: W/System.err(10427):    at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:515)
09-24 13:05:06.518: W/System.err(10427):    at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
09-24 13:05:06.518: W/System.err(10427):    at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:321)
09-24 13:05:06.518: W/System.err(10427):    at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
09-24 13:05:06.518: W/System.err(10427):    at javax.xml.parsers.SAXParser.parse(SAXParser.java:390)
09-24 13:05:06.518: W/System.err(10427):    at javax.xml.parsers.SAXParser.parse(SAXParser.java:187)
09-24 13:05:06.528: W/System.err(10427):    at com.bookacab.map.RoadProvider.getRoute(RoadProvider.java:21)
09-24 13:05:06.528: W/System.err(10427):    at com.bookacab.MapRouteActActivity$2.run(MapRouteActActivity.java:82)
09-24 13:05:06.528: I/System.out(10427): MURALI: After getRoute mRoad com.bookacab.map.Road@412479a0
09-24 13:05:06.528: I/System.out(10427): THE NAME IS:::::::::::::::::null
09-24 13:05:06.528: I/System.out(10427): the des is::::::::::::::::::null
09-24 13:05:06.528: I/System.out(10427): the des is:::::::::++++++++++++++++++++++++++++++++:::::::::null   null
09-24 13:05:06.548: I/System.out(10427): MURALI: After  sendEmptyMessage
09-24 13:05:06.658: D/dalvikvm(147): GC_FOR_ALLOC freed 450K, 16% free 10419K/12359K, paused 58ms
09-24 13:05:06.658: W/ActivityManager(147): Duplicate finish request for ActivityRecord{412bac60 com.bookacab/.MapRouteActActivity}
09-24 13:05:06.668: D/ViewRootImpl(10427): pckname = com.bookacab
09-24 13:05:06.668: I/WindowManager(147): MediaPlayer.is not PlayingVideo
09-24 13:05:06.678: I/InputReader(147): Reconfiguring input devices.  changes=0x00000004
09-24 13:05:06.678: I/InputReader(147): Device reconfigured: id=2, name='ft5x_ts', surface size is now 800x480, mode is 1
09-24 13:05:06.688: I/ActivityManager(147): Config changed: {1.0 0mcc0mnc en_IN layoutdir=0 sw640dp w1066dp h592dp lrg land finger -
4

0 回答 0