ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

终结器抛出未捕获的异常

2019-10-13 20:24:24  阅读:279  来源: 互联网

标签:android android-layout android-mapview


嗨,我收到此错误.我正在使用这个
代码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)

这是我的clickevent ..我从上面的android hive示例引用了相同的代码..这是我需要的代码
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);
        }
    });

解决方法:

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

标签:android,android-layout,android-mapview
来源: https://codeday.me/bug/20191013/1910355.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有