Commit 3a135fdd authored by Administrator's avatar Administrator

bugfix

parent 727b97c4
......@@ -7,3 +7,5 @@ build/
/captures
.externalNativeBuild
.cxx
*.apk
ratelConfig.properties
\ No newline at end of file
......@@ -71,7 +71,7 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
private MapView mMapView;
private static BaiduMap mBaiduMap;
// 初始化全局 bitmap 信息,不用时及时 recycle
private BitmapDescriptor bd = BitmapDescriptorFactory.fromResource(R.mipmap.icon_gcoding);
private BitmapDescriptor bd =null;//= BitmapDescriptorFactory.fromResource(R.mipmap.icon_gcoding);
private static Marker mMarker;
private static LatLng curLatlng;
private static GeoCoder mSearch;
......@@ -97,6 +97,11 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_FINE_LOCATION},
99);
if (PermissionUtil.checkPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
bd = BitmapDescriptorFactory.fromResource(R.mipmap.icon_gcoding);
}
super.onCreate(savedInstanceState);
}
......@@ -107,6 +112,8 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
SDKInitializer.initialize(getApplicationContext());
SDKInitializer.setCoordType(CoordType.GCJ02);
bd = BitmapDescriptorFactory.fromResource(R.mipmap.icon_gcoding);
initOverlay();
} else {
Toast.makeText(this, "没有权限,无法工作", Toast.LENGTH_SHORT).show();
}
......@@ -244,7 +251,10 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
mLocClient.setLocOption(option);
initOverlay();
if (PermissionUtil.checkPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
initOverlay();
}
}
......@@ -352,7 +362,9 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
mBaiduMap.setMyLocationEnabled(false);
mMapView.onDestroy();
mMapView = null;
bd.recycle();
if (bd != null) {
bd.recycle();
}
mSearch.destroy();
super.onDestroy();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment