Refine search
private ViewHolder(View itemView) { super(itemView); layout = itemView; mapView = layout.findViewById(R.id.lite_listrow_map); title = layout.findViewById(R.id.lite_listrow_text); if (mapView != null) { // Initialise the MapView mapView.onCreate(null); // Set the map ready callback to receive the GoogleMap object mapView.getMapAsync(this); } }
@Override protected void onPause() { mMapView.onPause(); super.onPause(); }
private void initView(View rootView, Bundle mapViewBundle) { // Bundle mapViewBundle = null; // if (savedInstanceState != null) { // mapViewBundle = savedInstanceState.getBundle(MAPVIEW_BUNDLE_KEY); // } // mMapView = (MapView) findViewById(R.id.map); mMapView = rootView.findViewById(R.id.google_map_view); mMapView.onCreate(mapViewBundle); mMapView.onResume(); mMapView.getMapAsync(this); }
private void setupMap( final LatLng center, final Bundle savedInstanceState ) { mapView = new MapView( this ); mapView.onCreate(savedInstanceState); MapsInitializer.initialize(this); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) { mapRender = new MapRender(DBResultActivity.this, googleMap, true); if (center != null) { final CameraPosition cameraPosition = new CameraPosition.Builder() .target(center).zoom(DEFAULT_ZOOM).build(); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } } }); final RelativeLayout rlView = (RelativeLayout) findViewById( R.id.db_map_rl ); rlView.addView( mapView ); }
@Override public void onCapture(final Bitmap originalBitmap, @NonNull final BitmapProcessorListener bitmapProcessorListener) { mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { googleMap.snapshot(new GoogleMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap snapshot) { int[] location = new int[2]; mapView.getLocationOnScreen(location); Bitmap bmOverlay = mergeBitmaps(originalBitmap, snapshot, location); bitmapProcessorListener.onBitmapReady(bmOverlay); } }); } }); }
@Override protected void onResume() { super.onResume(); mMapView.onResume(); }
@Override public void onCreate(Bundle savedInstanceState) { mapView.onCreate(savedInstanceState); }
@Override public void onLowMemory() { super.onLowMemory(); mMapView.onLowMemory(); }
@Override protected void onDestroy() { mMapView.onDestroy(); super.onDestroy(); }
@Override public void onDestroy() { MainActivity.info( "MAP: destroy mapping." ); finishing.set(true); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) { // save zoom final SharedPreferences prefs = getActivity().getSharedPreferences(ListFragment.SHARED_PREFS, 0); if (null != prefs) { final Editor edit = prefs.edit(); edit.putFloat(ListFragment.PREF_PREV_ZOOM, googleMap.getCameraPosition().zoom); edit.apply(); } else { MainActivity.warn("failed saving map state - unable to get preferences."); } // save center state.oldCenter = googleMap.getCameraPosition().target; } }); try { mapView.onDestroy(); } catch (NullPointerException ex) { // seen in the wild MainActivity.info("exception in mapView.onDestroy: " + ex, ex); } super.onDestroy(); }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Bundle mapViewBundle = outState.getBundle(MAPVIEW_BUNDLE_KEY); if (mapViewBundle == null) { mapViewBundle = new Bundle(); outState.putBundle(MAPVIEW_BUNDLE_KEY, mapViewBundle); } mMapView.onSaveInstanceState(mapViewBundle); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mapView = new MapView(getActivity()); final int serviceAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()); if (serviceAvailable == ConnectionResult.SUCCESS) { try { mapView.onCreate(savedInstanceState); } catch (final SecurityException ex) { MainActivity.error("security exception oncreateview map: " + ex, ex); } } else { WiGLEToast.showOverFragment(this.getActivity(), R.string.fatal_pre_message, getString(R.string.map_needs_playservice)); } MapsInitializer.initialize(getActivity()); final View view = inflater.inflate(R.layout.map, container, false); LatLng oldCenter = null; int oldZoom = Integer.MIN_VALUE; if (state.oldCenter != null) { // pry an orientation change, which calls destroy oldCenter = state.oldCenter; oldZoom = state.oldZoom; } setupMapView(view, oldCenter, oldZoom); return view; }
if ( location != null ) { if ( state.locked ) { mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) { mapView.postInvalidate();
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mapView.setLayoutParams(params); rlView.addView(mapView); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) {
@Override public void onResume() { MainActivity.info( "MAP: onResume" ); if (mapRender != null) { mapRender.onResume(); } if (null != mapView) { //refresh tiles on resume mapView.postInvalidate(); } if (null != tileOverlay) { //DEBUG: MainActivity.info("clearing tile overlay cache"); tileOverlay.clearTileCache(); } super.onResume(); setupTimer(); getActivity().setTitle(R.string.mapping_app_name); mapView.onResume(); }
View view = inflater.inflate(R.layout.places_search_item_map_fragment, container, false); mMapView = view.findViewById(R.id.map); mMapView.onCreate(savedInstanceState); mStartAddress = view.findViewById(R.id.start_address); spinner = view.findViewById(R.id.spinner); mMapView.onResume();// needed to get the map to display immediately mMapView.getMapAsync(new OnMapReadyCallback(){
private void setupMap( final Network network, final Bundle savedInstanceState ) { mapView = new MapView( this ); try { mapView.onCreate(savedInstanceState); } catch (NullPointerException ex) { MainActivity.error("npe in mapView.onCreate: " + ex, ex); } MapsInitializer.initialize( this ); if ((network != null) && (network.getLatLng() != null)) { mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) { final CameraPosition cameraPosition = new CameraPosition.Builder() .target(network.getLatLng()).zoom(DEFAULT_ZOOM).build(); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); googleMap.addCircle(new CircleOptions() .center(network.getLatLng()) .radius(5) .fillColor(Color.argb(128, 240, 240, 240)) .strokeColor(Color.argb(200, 255, 32, 32)) .strokeWidth(3f) .zIndex(100)); } }); } final RelativeLayout rlView = (RelativeLayout) findViewById( R.id.netmap_rl ); rlView.addView( mapView ); }
private void initMap() { isMapReady = false; try { binding.mapView.getMapAsync(this); } catch (Exception ignored) { } }