Java Code Examples for com.amap.api.maps.MapView#getMap()

The following examples show how to use com.amap.api.maps.MapView#getMap() . 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: TrafficActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.traffic_activity);

    mapView = (MapView) findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);

    aMap = mapView.getMap();

    findViewById(R.id.traffic_road).setOnClickListener(this);
    findViewById(R.id.traffic_circle).setOnClickListener(this);

    trafficSearch = new TrafficSearch(this);
    trafficSearch.setTrafficSearchListener(this);
}
 
Example 2
Source File: LocationActivity.java    From xmpp with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_location);
    mapView = (MapView) findViewById(R.id.map_route);
    mlist = (ListView) findViewById(R.id.location_listView);
    ll_back= (LinearLayout) findViewById(R.id.location_layout_back);
    ll_back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    mlist.setOnItemClickListener(this);
    mapView.onCreate(savedInstanceState);
    if (aMap == null) {
        aMap = mapView.getMap();
        aMap.setOnCameraChangeListener(this);
        setUpMap();
    }


}
 
Example 3
Source File: AMapViewManager.java    From react-native-amap with MIT License 6 votes vote down vote up
@ReactProp(name = "region")
public void setRegion(MapView mapView, @Nullable ReadableMap region) {
    if (region == null) return;
    AMap map = mapView.getMap();
    Double lat = region.getDouble("latitude");
    Double lng = region.getDouble("longitude");
    Double lngDelta = region.getDouble("longitudeDelta");
    Double latDelta = region.getDouble("latitudeDelta");
    LatLngBounds bounds = new LatLngBounds(
        new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
        new LatLng(lat + latDelta / 2, lng + lngDelta / 2)  // northeast
    );
    if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) {
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10));
        boundsToMove = bounds;
    } else {
        map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
    }
}
 
Example 4
Source File: AMapViewManager.java    From react-native-amap with MIT License 6 votes vote down vote up
public void addFeature(MapView parent, View child, int index) {
    AMap map = parent.getMap();
    if (child instanceof AMapMarker) {
        AMapMarker annotation = (AMapMarker) child;
        annotation.addToMap(map);
        features.add(index, annotation);
        Marker marker = (Marker) annotation.getFeature();
        markerMap.put(marker, annotation);
    } else if (child instanceof AMapPolyline) {
        AMapPolyline polylineView = (AMapPolyline) child;
        polylineView.addToMap(map);
        features.add(index, polylineView);
        Polyline polyline = (Polyline) polylineView.getFeature();
        polylineMap.put(polyline, polylineView);
    } else {
        ViewGroup children = (ViewGroup) child;
        for (int i = 0; i < children.getChildCount(); i++) {
          addFeature(parent, children.getChildAt(i), index);
        }
    }
}
 
Example 5
Source File: MainActivity.java    From Android_UsingCar_Example with Apache License 2.0 6 votes vote down vote up
private void init(Bundle savedInstanceState) {

		mAddressTextView = (TextView) findViewById(R.id.address_text);
		mDestinationButton = (Button) findViewById(R.id.destination_button);
		mDestinationButton.setOnClickListener(this);
		mMapView = (MapView) findViewById(R.id.map);
		mMapView.onCreate(savedInstanceState);
		mAmap = mMapView.getMap();
		mAmap.getUiSettings().setZoomControlsEnabled(false);
		mAmap.setOnMapLoadedListener(this);
		mAmap.setOnCameraChangeListener(this);

		mDestinationContainer = (LinearLayout) findViewById(R.id.destination_container);
		mRouteCostText = (TextView) findViewById(R.id.routecost_text);
		mDesitinationText = (TextView) findViewById(R.id.destination_text);
		mDesitinationText.setOnClickListener(this);
		mLocationImage = (ImageView) findViewById(R.id.location_image);
		mLocationImage.setOnClickListener(this);
		mFromToContainer = (LinearLayout) findViewById(R.id.fromto_container);
		mCancelButton = (Button) findViewById(R.id.cancel_button);

	}
 
Example 6
Source File: DistrictWithBoundaryActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.district_boundary_activity);
	mButton = (Button) findViewById(R.id.search_button);
	mEditText = (EditText) findViewById(R.id.city_text);
	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	mAMap = mMapView.getMap();
	mButton.setOnClickListener(this);

}
 
Example 7
Source File: BuildingOverlayActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_building_overlay);
    mapView = (MapView) findViewById(R.id.mapView);
    mapView.onCreate(savedInstanceState);
    map = mapView.getMap();
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.922632, 116.391874), 17));
}
 
Example 8
Source File: HeatMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.heatmap_activity);
	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	mAMap = mMapView.getMap();
	initDataAndHeatMap();
}
 
Example 9
Source File: PoiClickActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.poiclick_activity);
	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	mAMap = mMapView.getMap();
	mAMap.setOnPOIClickListener(this);
	mAMap.setOnMarkerClickListener(this);
}
 
Example 10
Source File: MapActivity.java    From TestChat with Apache License 2.0 5 votes vote down vote up
@Override
public void initView() {
        LogUtil.e("222123213mapInitView");
        send = (Button) findViewById(R.id.btn_map_send);
        back = (Button) findViewById(R.id.btn_map_back);
        display = (MapView) findViewById(R.id.mv_display);
        type = (Button) findViewById(R.id.btn_map_type);
        if (display != null) {
                display.onCreate(savedInstanceState);
        }
        send.setOnClickListener(this);
        back.setOnClickListener(this);
        type.setOnClickListener(this);
        if (mMap == null) {
                mMap = display.getMap();
        }

        mMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
                @Override
                public void onMapLoaded() {
                        mMap.setOnMapLoadedListener(null);
                        LogUtil.e("视图加载完成1111122111");
                        send.setClickable(true);
                        type.setClickable(true);
                        LogUtil.e("1浏览更新");
                        updateMarkerLocation();
                }
        });
}
 
Example 11
Source File: AMapViewManager.java    From react-native-amap with MIT License 5 votes vote down vote up
@Override
protected MapView createViewInstance(ThemedReactContext reactContent) {
    AMapOptions options = new AMapOptions();
    options.zoomControlsEnabled(false);
    //options.zoomGesturesEnabled(false);
    //options.rotateGesturesEnabled(false);
    mapView = new MapView(reactContent, options);
    mapView.onCreate(null);
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
    map = mapView.getMap();
    eventDispatcher = reactContent.getNativeModule(UIManagerModule.class).getEventDispatcher();
    return mapView;
}
 
Example 12
Source File: AMapViewManager.java    From react-native-amap with MIT License 5 votes vote down vote up
@Override
public void removeViewAt(MapView parent, int index) {
    AMap map = parent.getMap();
    AMapFeature feature = features.remove(index);
    if (feature instanceof AMapMarker) {
        markerMap.remove(feature.getFeature());
    } else if (feature instanceof AMapPolyline) {
        polylineMap.remove(feature.getFeature());
    }
    feature.removeFromMap(map);
}
 
Example 13
Source File: MainActivity.java    From Android_Move_Example with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	mMapView = (MapView) findViewById(R.id.map);

	mMapView.onCreate(savedInstanceState);
	mAmap = mMapView.getMap();
	initRoadData();
	moveLooper();
}
 
Example 14
Source File: TwoMapActivity.java    From TraceByAmap with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_two_map);

    mapView = (MapView) findViewById(R.id.mapview);
    textureMapView = (MapView) findViewById(R.id.texturemapview);


    mapView.onCreate(savedInstanceState);
    textureMapView.onCreate(savedInstanceState);

    aMap1 = mapView.getMap();

    aMap2 = textureMapView.getMap();

    init();

}