当前位置: 首页>>代码示例>>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;未经允许,请勿转载。