我将GoogleMap放入Fragment,并在onViewCreated中得到:
mapView.onCreate(savedInstanceState);
mapView.onResume();
mapView.getMapAsync(new OnMapReadyCallback() {
@SuppressLint("MissingPermission")
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
mGoogleMap.setMyLocationEnabled(true);
LatLng myplace = new LatLng(00.0000, 00.0000);
mGoogleMap.addMarker(new MarkerOptions().position(myplace).title("Title").snippet("Description"));
CameraPosition cameraPosition = new CameraPosition.Builder().target(myplace).zoom(12).build();
mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
});
现在每个方向都发生了变化,我在AndroidStudio中看到-旋转1圈后探查器140MB-210MB,接下来的250MB-350MB,最后设备出现黑屏并重置:)
如何优化呢?