@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); } }); } }); }
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 onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.raw_mapview_demo); // *** IMPORTANT *** // MapView requires that the Bundle you pass contain _ONLY_ MapView SDK // objects or sub-Bundles. Bundle mapViewBundle = null; if (savedInstanceState != null) { mapViewBundle = savedInstanceState.getBundle(MAPVIEW_BUNDLE_KEY); } mMapView = (MapView) findViewById(R.id.map); mMapView.onCreate(mapViewBundle); mMapView.getMapAsync(this); }
private void initMap() { isMapReady = false; try { binding.mapView.getMapAsync(this); } catch (Exception ignored) { } }
private void initializeMapView() { if (mapView != null) { mapView.onCreate(null); mapView.getMapAsync(this); } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_basic, container, false); areaTextView = (TextView) view.findViewById(R.id.area); lengthTextView = (TextView) view.findViewById(R.id.length); mMap = (MapView) view.findViewById(R.id.mapLite); mMap.onCreate(savedInstanceState); mMap.getMapAsync(this); return view; }
@Override public void call(final Subscriber<? super GoogleMap> subscriber) { MainThreadSubscription.verifyMainThread(); OnMapReadyCallback callback = new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(googleMap); } } }; mapView.getMapAsync(callback); } }
public void initializeMapView(int pos,AddressModel address) { try{ position=pos; addressModel=address; if (mapView != null) { // Initialise the MapView mapView.onCreate(null); // Set the map ready callback to receive the GoogleMap object mapView.getMapAsync(this); }else{ Log.e("Map","Mapview null"); } }catch (Exception e){ e.printStackTrace(); } }
@Override public void getMapAsync(final OnMapReadyCallback callback) { if (map != null) { callback.onMapReady(map); return; } mapView.getMapAsync(new com.google.android.gms.maps.OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { if (map == null) { map = new GoogleMapAdapter(googleMap); } callback.onMapReady(map); } }); }
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 initialize() { mTxtFineLocation = (TextView) getRootView().findViewById(R.id.txt_request_fine_location); mTxtLocationTitle = (TextView) getRootView().findViewById(R.id.txt_location_title); mMapView = (MapView) getRootView().findViewById(R.id.map_preview); mMapView.getMapAsync(this); }
tv.setText( " " + Integer.toString( observations ) ); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) {
mMap = (MapView) view.findViewById(R.id.mapLite); mMap.onCreate(savedInstanceState); mMap.getMapAsync(this); return view;
@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(); }
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 ); }
if ( location != null ) { if ( state.locked ) { mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); mMap = findViewById(R.id.mapLite); mMap.onCreate(savedInstanceState); mMap.getMapAsync(this); setUpButtons(); }
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 ); }
@Test public void shouldReturnMapFromView() { TestSubscriber<GoogleMap> subscriber = new TestSubscriber<>(); new MapObservableProvider(mapView) .getMapReadyObservable() .subscribe(subscriber); verify(mapView).getMapAsync(argumentCaptor.capture()); argumentCaptor.getValue().onMapReady(googleMap); subscriber.assertNoErrors(); subscriber.assertValue(googleMap); }
MainActivity.info( "set center: " + center + " network: " + network.getSsid() + " point: " + network.getLatLng()); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) {