本文整理匯總了Java中com.google.android.gms.maps.MapView類的典型用法代碼示例。如果您正苦於以下問題:Java MapView類的具體用法?Java MapView怎麽用?Java MapView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MapView類屬於com.google.android.gms.maps包,在下文中一共展示了MapView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
/**
* Called on activity start. Generates layout and button functionality.
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_habits_map);
events = (ArrayList<HabitEvent>) getIntent().getSerializableExtra("event list");
if (events==null || events.size()<1){finish();}
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar);
toolbar.setTitle("Map of My Habit History");
toolbar.setNavigationIcon(R.drawable.ic_close_button);
setSupportActionBar(toolbar);
map = (MapView) findViewById(R.id.myHabitsMap);
map.onCreate(savedInstanceState);
map.getMapAsync(this);
}
示例2: preLoadGoogleMaps
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void preLoadGoogleMaps() {
new Thread(new Runnable() {
@Override
public void run() {
try {
MapView mv = new MapView(getApplicationContext());
mv.onCreate(null);
mv.onPause();
mv.onDestroy();
} catch (Exception ignored) {
// ignored
}
}
}).start();
}
示例3: onCreateView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_challenge_sender, container, false);
mapView = (MapView) view.findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
googleApiClient = ((ChallengeActivity)getActivity()).getGoogleApiClient();
locationSettingsHandler = ((ChallengeActivity)getActivity()).getLocationSettingsHandler();
distance = (TextView) view.findViewById(R.id.sender_distance);
String userName = ((AppRunnest)getActivity().getApplication()).getUser().getName();
run = new Run(userName);
return view;
}
示例4: onCreateView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_running_map, container, false);
// Buttons
GUISetup(view);
mapView = (MapView) view.findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this); //this is important
// Location
setupLocation();
return view;
}
示例5: createViewInstance
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
/**
* 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;
}
示例6: getScreenshotBitmap
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@NonNull
@Override
public Observable<Bitmap> getScreenshotBitmap(@NonNull final Activity activity) {
final Observable<Bitmap> nonMapViewsBitmapObservable = getNonMapViewsBitmap(activity);
final View rootView = ActivityUtils.getRootView(activity);
final List<MapView> mapViews = locateMapViewsInHierarchy(rootView);
if (mapViews.isEmpty()) {
return nonMapViewsBitmapObservable;
} else {
final Observable<List<LocatedBitmap>> mapViewBitmapsObservable
= getMapViewBitmapsObservable(mapViews);
return Observable
.zip(nonMapViewsBitmapObservable, mapViewBitmapsObservable, BITMAP_COMBINING_FUNCTION);
}
}
示例7: locateMapViewsInHierarchy
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@NonNull
@VisibleForTesting
protected List<MapView> locateMapViewsInHierarchy(@NonNull final View view) {
final List<MapView> result = new ArrayList<>();
final Queue<View> viewsToProcess = new LinkedList<>();
viewsToProcess.add(view);
while (!viewsToProcess.isEmpty()) {
final View viewToProcess = viewsToProcess.remove();
if (viewToProcess instanceof MapView && viewToProcess.getVisibility() == VISIBLE) {
result.add((MapView) viewToProcess);
} else if (viewToProcess instanceof ViewGroup) {
final ViewGroup viewGroup = (ViewGroup) viewToProcess;
for (int childIndex = 0; childIndex < viewGroup.getChildCount(); childIndex++) {
viewsToProcess.add(viewGroup.getChildAt(childIndex));
}
}
}
return result;
}
示例8: onViewCreated
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mapView = (MapView) view.findViewById(R.id.ec_mapview);
if(mapView != null) {
mapView.onCreate(savedInstanceState);
}
if (defaultSceneLocations != null) {
List<String> list = new ArrayList<String>();
for (LocationItem scLoc : defaultSceneLocations) {
list.add(scLoc.getTitle());
}
setupPins();
}
mapButton = (Button) view.findViewById(R.id.map_button);
satelliteButton = (Button) view.findViewById(R.id.satellite_button);
if (satelliteButton != null && mapButton != null) {
mapButton.setOnClickListener(this);
satelliteButton.setOnClickListener(this);
onClick(mapButton);
}
}
示例9: onCreateView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.map_fragment, container, false);
mMapView = ((MapView) rootView.findViewById(R.id.map));
mMapView.onCreate(savedInstanceState);
mMapView.getMapAsync(this);
MapsInitializer.initialize(getActivity());
RealTimePositionVelocityCalculator currentPositionVelocityCalculator =
mPositionVelocityCalculator;
if (currentPositionVelocityCalculator != null) {
currentPositionVelocityCalculator.setMapFragment(this);
}
return rootView;
}
示例10: onSaveInstanceState
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
movementManager.onSaveInstanceState(savedInstanceState);
pinningManager.onSaveInstanceState(savedInstanceState);
savedInstanceState.putBoolean(BUNDLE_OSM_ACTIVE, osmActive);
if (!osmActive) {
Bundle mapBundle = new Bundle();
googleMapView.onSaveInstanceState(mapBundle);
savedInstanceState.putBundle(BUNDLE_MAP, mapBundle);
}else if (jotiMap instanceof OsmJotiMap){
org.osmdroid.views.MapView osmMap = ((OsmJotiMap) jotiMap).getOSMMap();
Bundle osmMapBundle = new Bundle();
osmMapBundle.putInt(OSM_ZOOM, osmMap.getZoomLevel());
osmMapBundle.putDouble(OSM_LAT, osmMap.getMapCenter().getLatitude());
osmMapBundle.putDouble(OSM_LNG, osmMap.getMapCenter().getLongitude());
osmMapBundle.putFloat(OSM_OR, osmMap.getMapOrientation());
savedInstanceState.putBundle(OSM_BUNDLE, osmMapBundle);
}
// Always call the superclass so it can save the view hierarchy state
super.onSaveInstanceState(savedInstanceState);
}
示例11: onCreateView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.location_fragment, 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;
refreshMap(null);
}
});
return rootView;
}
示例12: getView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
/**
* Manages creating or re-using the ViewHolder for each grid item.
*/
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = ((LayoutInflater) mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.grid_item, null);
holder = new ViewHolder();
holder.mapView = (MapView) convertView.findViewById(R.id.grid_item);
convertView.setTag(holder);
holder.initializeMapView();
} else {
holder = (ViewHolder) convertView.getTag();
}
SnazzyMapsStyle style = (SnazzyMapsStyle) getItem(position);
holder.mapView.setTag(style);
if (holder.map != null) {
initializeMap(holder.map, style);
}
return convertView;
}
示例13: onCreateView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_detail_location, container, false);
mMapView = (MapView) root.findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
mMapView.onResume();
recycleView = (RecyclerView) root.findViewById(R.id.location_recycler_view);
locationAdapter = new LocationAdapter(getActivity());
recycleView.setAdapter(locationAdapter);
recycleView.setLayoutManager(new LinearLayoutManager(getActivity()));
return root;
}
示例14: onCreateView
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_map_search, container, false);
ButterKnife.bind(this, view);
unWrapBundle(savedInstanceState);
// http://stackoverflow.com/questions/13900322/badparcelableexception-in-google-maps-code
if (savedInstanceState != null) {
savedInstanceState.remove(BundleKeys.STOPS);
}
// initialize the map!
googleMapView = ((MapView) view.findViewById(R.id.search_google_maps));
googleMapView.onCreate(savedInstanceState);
googleMapView.getMapAsync(this);
return view;
}
示例15: init
import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void init() {
super.init();
mMapView = (MapView) findViewById(R.id.map);
mMapHelper = new MapHelper(getMainActivity());
if (mMapView != null) {
mMapView.onCreate(null);
mMapView.getMapAsync(mMapHelper);
}
txtLatitude = (TextView) findViewById(R.id.txtLatitude);
txtLongitude = (TextView) findViewById(R.id.txtLongitude);
txtMapGPS = (TextView) findViewById(R.id.txtMapGPS);
txtMapGPSSatsInView = (TextView) findViewById(R.id.txtMapGPSSatsInView);
}