Uncaught exception thrown by finalizer

后端 未结 2 1102
天涯浪人
天涯浪人 2021-01-23 12:56

Hi i am geting this error. i am using this code http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/

when i on click of Show place

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 13:33

    This is the code for getting Google directions between two locations. May this help you.

    double srcLatitude = 0;
    double srcLongitude = 0;
    Location location = GeoLocationUtil.getGeoLocation(this);
    if (GeoLocationUtil.isValidLocation(location)) {
        srcLatitude = location.getLatitude();
        srcLongitude = location.getLongitude();
    }
    
    final Intent intent = new Intent(Intent.ACTION_VIEW,
    /** Using the web based turn by turn directions url. */
    Uri.parse("http://maps.google.com/maps?" + "saddr=" + srcLatitude + ","
        + srcLongitude + "&daddr=" + destLat + "," + destLong));
    
    intent.setClassName("com.google.android.apps.maps",
        "com.google.android.maps.MapsActivity");
    startActivity(intent);
    

提交回复
热议问题