【问题标题】:Uncaught exception thrown by finalizer终结器抛出未捕获的异常
【发布时间】:2012-08-28 11:24:07
【问题描述】:

您好,我收到此错误。我正在使用这个 代码http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/

当我点击在地图上显示位置时,我得到了这个错误。请给我解决方案

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)

这是我的点击事件..我从上面的 android hive 示例中引用了相同的代码..这是你需要的我的代码 Can anyone guide me how to get Google Directions between two locations using JSON

点击事件

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);
        }
    });

【问题讨论】:

  • 显示您的点击事件和更多相关代码。
  • @PadmaKumar 以上是我的 onclick 事件。
  • 我也遇到了同样的情况。但我不知道我该怎么办。

标签: android android-layout android-mapview


【解决方案1】:

这是在两个位置之间获取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);

【讨论】:

    【解决方案2】:

    正如我在这个答案中所写: https://stackoverflow.com/a/13161591/1716620

    我认为问题是由于执行绘图时不正确的缩放级别引起的, 尝试在执行绘图之前检查您的缩放级别,我这样解决了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-12
      相关资源
      最近更新 更多