Java Code Examples for com.google.android.gms.maps.MapView#onCreate()
The following examples show how to use
com.google.android.gms.maps.MapView#onCreate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewOrderFragment.java From CourierApplication with Mozilla Public License 2.0 | 6 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { mPresenter = new NewOrderPresenter(this); mPresenter.setGMapsUrl(getString(R.string.google_maps_key)); mPresenter.sendFragmentActivityToInteractor(); mDistanceView = (TextView) view.findViewById(R.id.neworder_textview_summary); mCalculateButton = (Button) view.findViewById(R.id.neworder_button_calculate); mAdditionalButton = (Button) view.findViewById(R.id.neworder_button_additional); mCallButton = (Button) view.findViewById(R.id.neworder_button_call); placesFrom = (TextView) view.findViewById(R.id.place_autocomplete_from); placesTo = (TextView) view.findViewById(R.id.place_autocomplete_to); mMapView = (MapView) view.findViewById(R.id.neworder_map); mMapView.onCreate(savedInstanceState); mPresenter.onMapAsyncCall(); setListeners(); }
Example 2
Source File: PPTGoogleMapManager.java From react-native-maps with MIT License | 6 votes |
/** * Implementation of the react create view instance method - returns the map view to react. * * @param context * @return MapView */ @Override protected MapView createViewInstance(ThemedReactContext context) { mapView = new MapView(context); mapView.onCreate(null); mapView.onResume(); if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); } reactContext = context; return mapView; }
Example 3
Source File: MapFragment.java From actor-platform with GNU Affero General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { longitude = getArguments().getDouble("longitude"); latitude = getArguments().getDouble("latitude"); final MapView map = new MapView(getActivity()); map.onCreate(null); map.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { mapController = googleMap; googleMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title("")); googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(latitude, longitude), 16)); map.onResume(); } }); return map; }
Example 4
Source File: RawMapViewDemoActivity.java From android-samples with Apache License 2.0 | 6 votes |
@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); }
Example 5
Source File: GalleryAdapter.java From animation-samples with Apache License 2.0 | 5 votes |
private void initializeMapView(MapView mapView) { mapView.onCreate(null); mapView.getMapAsync(mInitialOnMapReadyCallback); // lite mode enabled within map's layout declaration // Requirement to set clickable to false in order to not open the Google Maps application. // See: https://developers.google.com/maps/documentation/android-api/events#disabling_click_events_in_lite_mode mapView.setClickable(false); }
Example 6
Source File: AtlasFragment.java From memoir with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_atlas, container, false); MapsInitializer.initialize(getActivity()); mMapView = (MapView) v.findViewById(R.id.map_view); mMapView.onCreate(mBundle); mMapView.getMapAsync(this); return v; }
Example 7
Source File: PlaceActivity.java From ratebeer with GNU General Public License v3.0 | 5 votes |
@SuppressLint("PrivateResource") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_place); mainToolbar = setupDefaultUpButton(); mainToolbar.inflateMenu(R.menu.menu_link); mapView = (MapView) findViewById(R.id.map_view); mapView.onCreate(savedInstanceState); loadingProgress = (ProgressBar) findViewById(R.id.loading_progress); detailsLayout = findViewById(R.id.details_layout); }
Example 8
Source File: LocalPlacesAdapter.java From ratebeer with GNU General Public License v3.0 | 5 votes |
public MapHeaderHolder(View v) { super(v); mapView = (MapView) v; // Call through onCreate and onResume because we had these already but the MapView did not yet exist then mapView.onCreate(null); mapView.onResume(); mapView.getMapAsync(googleMap -> googleMap.getUiSettings().setMapToolbarEnabled(false)); }
Example 9
Source File: MapLocationViewHolder.java From android-map_list with MIT License | 5 votes |
public MapLocationViewHolder(Context context, View view) { super(view); mContext = context; title = (TextView) view.findViewById(R.id.title); description = (TextView) view.findViewById(R.id.description); mapView = (MapView) view.findViewById(R.id.map); mapView.onCreate(null); mapView.getMapAsync(this); }
Example 10
Source File: PlacesFragment.java From narrate-android with Apache License 2.0 | 4 votes |
private void setup() { mSheetAdapter = new EntriesRecyclerAdapter(mainActivity.entries); mapView = (MapView) mRoot.findViewById(R.id.mapView); mapView.setAlwaysDrawnWithCacheEnabled(true); mapView.setPersistentDrawingCache(MapView.PERSISTENT_ALL_CACHES); mapView.onCreate(null); try { MapsInitializer.initialize(getActivity().getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } map = mapView.getMap(); mClusterManager = new ClusterManager<EntryMarker>(getActivity(), map); map.setOnCameraChangeListener(mClusterManager); map.setOnMarkerClickListener(mClusterManager); mClusterManager.setOnClusterClickListener(this); mClusterManager.setOnClusterItemClickListener(this); onDataUpdated(); if (ActivityCompat.checkSelfPermission(mainActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mainActivity, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { map.setMyLocationEnabled(false); if ( getActivity() != null && getActivity().getSystemService(Context.LOCATION_SERVICE) != null) { String locationProvider = LocationManager.NETWORK_PROVIDER; LocationManager mLocationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); lastKnownLocation = mLocationManager.getLastKnownLocation(locationProvider); } new Handler().postDelayed(new Runnable() { @Override public void run() { if ( !isAdded() ) return; if ( lastKnownLocation != null ) { LatLng position = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()); CameraPosition newPosition = CameraPosition.fromLatLngZoom(position, 12.0f); map.animateCamera(CameraUpdateFactory.newCameraPosition(newPosition)); } } }, 500); } }
Example 11
Source File: PublishFragment.java From kute with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.publishfragment, container, false); mMapView = (MapView) rootView.findViewById(R.id.mapViewpublish); mMapView.onCreate(savedInstanceState); mMapView.onResume(); // needed to get the map to display immediately try { MapsInitializer.initialize(getActivity().getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } mMapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap mMap) { googleMap = mMap; // For showing a move to my location button if (ActivityCompat.checkSelfPermission(getActivity().getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity().getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } googleMap.setMyLocationEnabled(true); // For dropping a marker at a point on the Map LatLng sydney = new LatLng(-34, 151); googleMap.addMarker(new MarkerOptions().position(sydney).title("Marker Title Publish").snippet("Marker Description")); // For zooming automatically to the location of the marker CameraPosition cameraPosition = new CameraPosition.Builder().target(sydney).zoom(12).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } }); return rootView; }
Example 12
Source File: TrackFragment.java From kute with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.trackfragment, container, false); mMapView = (MapView) rootView.findViewById(R.id.mapView); mMapView.onCreate(savedInstanceState); mMapView.onResume(); // needed to get the map to display immediately try { MapsInitializer.initialize(getActivity().getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } mMapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap mMap) { googleMap = mMap; // For showing a move to my location button if (ActivityCompat.checkSelfPermission(getActivity().getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity().getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } googleMap.setMyLocationEnabled(true); // For dropping a marker at a point on the Map LatLng sydney = new LatLng(-34, 151); googleMap.addMarker(new MarkerOptions().position(sydney).title("Marker Title track").snippet("Marker Description")); // For zooming automatically to the location of the marker CameraPosition cameraPosition = new CameraPosition.Builder().target(sydney).zoom(12).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } }); return rootView; }
Example 13
Source File: MapViewHandler.java From PowerSwitch_Android with GNU General Public License v3.0 | 3 votes |
/** * Constructor * * @param context any suitable context * @param mapView MapView * @param savedInstanceState savedInstanceState used for MapView */ public MapViewHandler(Context context, MapView mapView, Bundle savedInstanceState) { this.context = context; this.mapView = mapView; mapView.onCreate(savedInstanceState); }