2012-08-28 65 views
1

您好,我正在創建此錯誤。我正在使用這個 代碼http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/終結者引發的未捕獲異常

當我點擊顯示地圖上的地圖這個錯誤我越來越。 PLZ ASY我的解決方案

08-28 16:38:20.554: E/System(4978): Uncaught exception thrown by finalizer 
08-28 16:38:20.554: E/System(4978): java.lang.IllegalStateException: Binder has been finalized! 
08-28 16:38:20.554: E/System(4978):  at android.os.BinderProxy.transact(Native Method) 
08-28 16:38:20.554: E/System(4978):  at android.database.BulkCursorProxy.close(BulkCursorNative.java:288) 
08-28 16:38:20.554: E/System(4978):  at android.database.BulkCursorToCursorAdaptor.close(BulkCursorToCursorAdaptor.java:133) 
08-28 16:38:20.554: E/System(4978):  at android.database.CursorWrapper.close(CursorWrapper.java:49) 
08-28 16:38:20.554: E/System(4978):  at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:1591) 
08-28 16:38:20.554: E/System(4978):  at android.content.ContentResolver$CursorWrapperInner.finalize(ContentResolver.java:1604) 
08-28 16:38:20.554: E/System(4978):  at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182) 
08-28 16:38:20.554: E/System(4978):  at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168) 
08-28 16:38:20.554: E/System(4978):  at java.lang.Thread.run(Thread.java:856) 

這是我在clickevent ..我從上面的Android蜂巢的樣品refered samecode ..這裏是我的代碼UU需要 Can anyone guide me how to get Google Directions between two locations using JSON

onclick事件

btnShowOnMap = (Button) findViewById(R.id.btn_show_map); 

    // calling background Async task to load Google Places 
    // After getting places from Google all the data is shown in listview 
    new LoadPlaces().execute(); 

    /** Button click event for shown on map */ 
    btnShowOnMap.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View arg0) { 
      Intent i = new Intent(getApplicationContext(), PlacesMapActivity.class); 
      // Sending user current geo location 
      Log.i("getLatitude",""+ gps.getLatitude()); 
      i.putExtra("user_latitude", Double.toString(gps.getLatitude())); 
      i.putExtra("user_longitude", Double.toString(gps.getLongitude())); 

      // passing near places to map activity 
      i.putExtra("near_places", nearPlaces); 
      // staring activity 
      startActivity(i); 
     } 
    }); 
+0

顯示您的點擊事件和更多相關代碼。 –

+0

@PadmaKumar上面是我的onclick事件。 –

+0

我遇到同樣的情況。但我不知道該怎麼辦。 – breceivemail

回答

0

這是在兩個地點之間獲取Google方向的代碼。願這能幫助你。

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); 
+0

你可以說我以上的錯誤.... –

0

正如我在回答中寫道: https://stackoverflow.com/a/13161591/1716620

我認爲這個問題是由uncorrect縮放級別導致在執行繪圖, 嘗試進行圖紙之前檢查你的縮放級別,我解決了這個方式