當前位置: 首頁>>代碼示例>>Java>>正文


Java OnMapReadyCallback類代碼示例

本文整理匯總了Java中com.google.android.gms.maps.OnMapReadyCallback的典型用法代碼示例。如果您正苦於以下問題:Java OnMapReadyCallback類的具體用法?Java OnMapReadyCallback怎麽用?Java OnMapReadyCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OnMapReadyCallback類屬於com.google.android.gms.maps包,在下文中一共展示了OnMapReadyCallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onStart

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
public void onStart()
{
    super.onStart();
    if (geoLocation != null)
        geoLocation.start(getContext());

    this.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            gMap = googleMap;
            initializeMap();
        }
    });

}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:17,代碼來源:RMBTMapFragment.java

示例2: showPointerOnMap

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
private void showPointerOnMap(final double latitude, final double longitude) {
    mvRestaurantLocation.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            LatLng latLng = new LatLng(latitude, longitude);
            googleMap.addMarker(new MarkerOptions()
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_flag))
                    .anchor(0.0f, 1.0f)
                    .position(latLng));
            googleMap.getUiSettings().setMyLocationButtonEnabled(false);
            googleMap.getUiSettings().setZoomControlsEnabled(true);

            // Updates the location and zoom of the MapView
            CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15);
            googleMap.moveCamera(cameraUpdate);
        }
    });
}
 
開發者ID:pranayairan,項目名稱:YelpQL,代碼行數:19,代碼來源:BusinessDetailsActivity.java

示例3: init

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
public void init() {
  getMapAsync(new OnMapReadyCallback() {
    @Override public void onMapReady(GoogleMap googleMap) {
      if (googleMap != null && getActivity() != null) {
        NativeGoogleMapFragment.this.googleMap = googleMap;
        UiSettings settings = NativeGoogleMapFragment.this.googleMap.getUiSettings();
        settings.setZoomControlsEnabled(false);
        settings.setMyLocationButtonEnabled(false);
        setMyLocationEnabled(myLocationEnabled);

        if (onMapLoadedListener != null) {
          onMapLoadedListener.onMapLoaded();
        }
      }
    }
  });
}
 
開發者ID:airbnb,項目名稱:AirMapView,代碼行數:18,代碼來源:NativeGoogleMapFragment.java

示例4: initViews

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
private void initViews() {
    getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap gMap) {
            googleMap = gMap;
            googleMap.getUiSettings().setAllGesturesEnabled(true);
            googleMap.clear();
            googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(DEFAULT_LATLNG, DEFAULT_ZOOM));
            setCustomInfoWindow();
            PlaceMapFragment.this.setMapListeners();
            if (place != null) PlaceMapFragment.this.showPlace(place, false, 0, listener);
            if (places != null && !places.isEmpty())
                PlaceMapFragment.this.showPlaces(places, false, places.get(0).getId(), listener);
        }
    });
}
 
開發者ID:miguelbcr,項目名稱:RxGpsService,代碼行數:17,代碼來源:PlaceMapFragment.java

示例5: setUpMapIfNeeded

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(GoogleMap googleMap) {
                mMap = googleMap;
            }
        });
        // Check if we were successful in obtaining the map.
        //  if (mMap != null) {
        //   setUpMap();
        //  }
    }
}
 
開發者ID:irshuLx,項目名稱:Android-WYSIWYG-Editor,代碼行數:17,代碼來源:MapsActivity.java

示例6: addFlightPathPoint

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
public void addFlightPathPoint(final LatLongAlt coord) {
    final LatLng position = MapUtils.coordToLatLng(coord);

    getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            if (showFlightPath) {
                if (flightPath == null) {
                    PolylineOptions flightPathOptions = new PolylineOptions();
                    flightPathOptions.color(FLIGHT_PATH_DEFAULT_COLOR)
                            .width(FLIGHT_PATH_DEFAULT_WIDTH).zIndex(1);
                    flightPath = googleMap.addPolyline(flightPathOptions);
                }

                List<LatLng> oldFlightPath = flightPath.getPoints();
                oldFlightPath.add(position);
                flightPath.setPoints(oldFlightPath);
            }
        }
    });
}
 
開發者ID:mxiao6,項目名稱:Tower-develop,代碼行數:23,代碼來源:GoogleMapFragment.java

示例7: updateDroneLeashPath

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
public void updateDroneLeashPath(PathSource pathSource) {
    List<LatLong> pathCoords = pathSource.getPathPoints();
    final List<LatLng> pathPoints = new ArrayList<LatLng>(pathCoords.size());
    for (LatLong coord : pathCoords) {
        pathPoints.add(MapUtils.coordToLatLng(coord));
    }

    if (mDroneLeashPath == null) {
        final PolylineOptions flightPath = new PolylineOptions();
        flightPath.color(DRONE_LEASH_DEFAULT_COLOR).width(
                MapUtils.scaleDpToPixels(DRONE_LEASH_DEFAULT_WIDTH, getResources()));

        getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(GoogleMap googleMap) {
                mDroneLeashPath = getMap().addPolyline(flightPath);
                mDroneLeashPath.setPoints(pathPoints);
            }
        });
    }
    else {
        mDroneLeashPath.setPoints(pathPoints);
    }
}
 
開發者ID:mxiao6,項目名稱:Tower-develop,代碼行數:26,代碼來源:GoogleMapFragment.java

示例8: updateMissionPath

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
public void updateMissionPath(PathSource pathSource) {
    List<LatLong> pathCoords = pathSource.getPathPoints();
    final List<LatLng> pathPoints = new ArrayList<>(pathCoords.size());
    for (LatLong coord : pathCoords) {
        pathPoints.add(MapUtils.coordToLatLng(coord));
    }

    if (missionPath == null) {
        final PolylineOptions pathOptions = new PolylineOptions();
        pathOptions.color(MISSION_PATH_DEFAULT_COLOR).width(MISSION_PATH_DEFAULT_WIDTH);
        getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(GoogleMap googleMap) {
                missionPath = getMap().addPolyline(pathOptions);
                missionPath.setPoints(pathPoints);
            }
        });
    }
    else {
        missionPath.setPoints(pathPoints);
    }
}
 
開發者ID:mxiao6,項目名稱:Tower-develop,代碼行數:24,代碼來源:GoogleMapFragment.java

示例9: onCreateView

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的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;
}
 
開發者ID:gautamgitspace,項目名稱:CellularNetworkMonitor,代碼行數:26,代碼來源:MapFragment.java

示例10: onCreateView

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    FrameLayout v = (FrameLayout) inflater.inflate(R.layout.fragment_map, container, false);

    mapView = (MapView) v.findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);
    mapView.onResume();
    mapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            Log.i("DevMsg", "Success!!!!!");
            myMap = googleMap;
            populateMap();
        }
    });


    return v;
}
 
開發者ID:danthedrummer,項目名稱:HuddlOut_client,代碼行數:22,代碼來源:MapFragment.java

示例11: loadCameraPosition

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
public void loadCameraPosition() {
    getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            final SharedPreferences settings = mAppPrefs.prefs;

            final CameraPosition.Builder camera = new CameraPosition.Builder();
            camera.bearing(settings.getFloat(PREF_BEA, DEFAULT_BEARING));
            camera.tilt(settings.getFloat(PREF_TILT, DEFAULT_TILT));
            camera.zoom(settings.getFloat(PREF_ZOOM, DEFAULT_ZOOM_LEVEL));
            camera.target(new LatLng(settings.getFloat(PREF_LAT, DEFAULT_LATITUDE),
                    settings.getFloat(PREF_LNG, DEFAULT_LONGITUDE)));

            googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(camera.build()));
        }
    });
}
 
開發者ID:sommishra,項目名稱:DroidPlanner-Tower,代碼行數:19,代碼來源:GoogleMapFragment.java

示例12: onCreate

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map_view);

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
    }

    mLatlng = getIntent().getStringExtra("latlng");

    if (mapMessageLocation == null) {
        mapMessageLocation = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapMessageLocation));
    }

    mapMessageLocation.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap map) {
            loadMap(map, mLatlng);
        }
    });
}
 
開發者ID:magnetsystems,項目名稱:message-samples-android,代碼行數:24,代碼來源:MapViewActivity.java

示例13: getMapReadyCallback

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
private OnMapReadyCallback getMapReadyCallback(final Attraction attraction) {
    return new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            mMap = googleMap;
            mMap.setMyLocationEnabled(true);
            mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
                @Override
                public void onMapClick(LatLng latLng) {
                    Intent intent = new Intent(mActivity, MapActivity.class);
                    intent.putExtra(Constants.EXTRA_ATTRACTION, attraction);
                    mActivity.startActivity(intent);
                }
            });
            updateMapLocation(attraction);
        }
    };
}
 
開發者ID:googlesamples,項目名稱:io2015-codelabs,代碼行數:19,代碼來源:AttractionsGridPagerAdapter.java

示例14: setUpMap

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
/**
 * Contains the basics for setting up the map.
 */
private void setUpMap() {
    if (Utils.checkNetwork(getActivity())) {
        if (mMap == null) {
            mMapFragment.getMapAsync(new OnMapReadyCallback() {
                @Override
                public void onMapReady(GoogleMap googleMap) {
                    Log.i(TAG, "onMapReady");
                    mMap = googleMap;
                    postSyncMapSetup();
                }
            });
        }

    } else {
        Utils.connectToast(getActivity());
    }
}
 
開發者ID:stinsonga,項目名稱:GeoQuake,代碼行數:21,代碼來源:QuakeMapFragment.java

示例15: onCreate

import com.google.android.gms.maps.OnMapReadyCallback; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    evercamCamera = VideoActivity.evercamCamera;

    setContentView(R.layout.activity_view_camera);

    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync((OnMapReadyCallback) this);

    setUpDefaultToolbar();

    // Initial UI elements
    initialScreen();
    fillCameraDetails(evercamCamera);
    vendorLogoImageView = (ImageView) findViewById(R.id.vendor_logo_image_view);
    modelThumbnailImageView = (ImageView) findViewById(R.id.model_thumbnail_image_view);

    new RequestVendorListTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

}
 
開發者ID:evercam,項目名稱:evercam-android,代碼行數:24,代碼來源:ViewCameraActivity.java


注:本文中的com.google.android.gms.maps.OnMapReadyCallback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。