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

The following examples show how to use com.amap.api.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: ShareActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.share_activity);
	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);// 此方法必须重写
	mLocationButton = (Button) findViewById(R.id.share_location);
	mRouteButton = (Button) findViewById(R.id.share_route);
	mPoiButton = (Button) findViewById(R.id.share_poi);
	mNaviButton = (Button) findViewById(R.id.share_navi);
	mUrlView = (WebView)findViewById(R.id.url_view);
	mLocationButton.setOnClickListener(this);
	mRouteButton.setOnClickListener(this);
	mPoiButton.setOnClickListener(this);
	mNaviButton.setOnClickListener(this);
	mShareSearch = new ShareSearch(this.getApplicationContext());
	mShareSearch.setOnShareSearchListener(this);
	init();
}
 
Example 2
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 3
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 4
Source File: ColourfulPolylineActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.arc_activity);
        /*
         * 设置离线地图存储目录,在下载离线地图或初始化地图设置;
         * 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
         * 则需要在离线地图下载和使用地图页面都进行路径设置
         * */
	    //Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
//        MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
		mapView = (MapView) findViewById(R.id.map);
		mapView.onCreate(savedInstanceState);// 此方法必须重写
		init();
		addPolylineInPlayGround(new LatLng(39.980215,116.34595));
		addPolylinesWithGradientColors();
		addPolylinesWithColors();
	}
 
Example 5
Source File: GeoFence_Round_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_geofence_new);
	setTitle(R.string.roundGeoFence);
	// 初始化地理围栏
	fenceClient = new GeoFenceClient(getApplicationContext());

	lyOption = findViewById(R.id.ly_option);
	btAddFence = (Button) findViewById(R.id.bt_addFence);
	btOption = (Button) findViewById(R.id.bt_option);
	tvGuide = (TextView) findViewById(R.id.tv_guide);
	tvResult = (TextView) findViewById(R.id.tv_result);
	tvResult.setVisibility(View.GONE);
	etCustomId = (EditText) findViewById(R.id.et_customId);
	etRadius = (EditText) findViewById(R.id.et_radius);

	cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
	cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
	cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);

	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	markerOption = new MarkerOptions().draggable(true);
	init();
}
 
Example 6
Source File: RecordShowActivity.java    From RecordPath3D with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.recorddisplay_activity);
	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);// 此方法必须重写
	mGraspRadioButton = (RadioButton) findViewById(R.id.record_show_activity_grasp_radio_button);
	mOriginRadioButton = (RadioButton) findViewById(R.id.record_show_activity_origin_radio_button);
	mOriginRadioButton.setOnClickListener(this);
	mGraspRadioButton.setOnClickListener(this);
	mDisplaybtn = (ToggleButton) findViewById(R.id.displaybtn);
	mDisplaybtn.setOnClickListener(this);
	Intent recordIntent = getIntent();
	int threadPoolSize = Runtime.getRuntime().availableProcessors() * 2 + 3;
	mThreadPool = Executors.newFixedThreadPool(threadPoolSize);
	if (recordIntent != null) {
		mRecordItemId = recordIntent.getIntExtra(RecordActivity.RECORD_ID,
				-1);
	}
	initMap();
}
 
Example 7
Source File: GeoFence_District_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_geofence_new);
	setTitle(R.string.districtGeoFence);
	// 初始化地理围栏
	fenceClient = new GeoFenceClient(getApplicationContext());

	lyOption = findViewById(R.id.ly_option);
	btAddFence = (Button) findViewById(R.id.bt_addFence);
	tvResult = (TextView) findViewById(R.id.tv_result);
	tvResult.setVisibility(View.GONE);

	etCustomId = (EditText) findViewById(R.id.et_customId);
	etKeyword = (EditText) findViewById(R.id.et_keyword);

	cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
	cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
	cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);

	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	init();
}
 
Example 8
Source File: GeoFence_Keyword_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_geofence_new);
	setTitle(R.string.keywordGeoFence);
	// 初始化地理围栏
	fenceClient = new GeoFenceClient(getApplicationContext());

	lyOption = findViewById(R.id.ly_option);
	btAddFence = (Button) findViewById(R.id.bt_addFence);
	btOption = (Button) findViewById(R.id.bt_option);
	tvResult = (TextView) findViewById(R.id.tv_result);
	tvResult.setVisibility(View.GONE);
	etCustomId = (EditText) findViewById(R.id.et_customId);
	etCity = (EditText) findViewById(R.id.et_city);
	etPoiType = (EditText) findViewById(R.id.et_poitype);
	etKeyword = (EditText) findViewById(R.id.et_keyword);
	etFenceSize = (EditText) findViewById(R.id.et_fenceSize);

	cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
	cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
	cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);

	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	markerOption = new MarkerOptions().draggable(true);
	init();
}
 
Example 9
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 10
Source File: ZoomActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.zoom_activity);
    /*
        * 设置离线地图存储目录,在下载离线地图或初始化地图设置;
        * 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
        * 则需要在离线地图下载和使用地图页面都进行路径设置
        * */
    //Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
      // MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
	mapView = (MapView) findViewById(R.id.map);
	mapView.onCreate(savedInstanceState);// 此方法必须重写
	init();
}
 
Example 11
Source File: GeoFence_Multiple_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_geofence_new);
	setTitle(R.string.multipleGeoFence);
	// 初始化地理围栏
	fenceClient = new GeoFenceClient(getApplicationContext());

	rgFenceType = (RadioGroup) findViewById(R.id.rg_fenceType);
	lyOption = findViewById(R.id.ly_option);
	btAddFence = (Button) findViewById(R.id.bt_addFence);
	btOption = (Button) findViewById(R.id.bt_option);
	tvGuide = (TextView) findViewById(R.id.tv_guide);
	tvResult = (TextView) findViewById(R.id.tv_result);
	tvResult.setVisibility(View.GONE);
	etCustomId = (EditText) findViewById(R.id.et_customId);
	etCity = (EditText) findViewById(R.id.et_city);
	etRadius = (EditText) findViewById(R.id.et_radius);
	etPoiType = (EditText) findViewById(R.id.et_poitype);
	etKeyword = (EditText) findViewById(R.id.et_keyword);
	etFenceSize = (EditText) findViewById(R.id.et_fenceSize);

	cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
	cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
	cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);


	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	markerOption = new MarkerOptions().draggable(true);
	init();
}
 
Example 12
Source File: RideRouteActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	setContentView(R.layout.route_activity);
	
	mContext = this.getApplicationContext();
	mapView = (MapView) findViewById(R.id.route_map);
	mapView.onCreate(bundle);// 此方法必须重写
	init();
	setfromandtoMarker();
	searchRouteResult(ROUTE_TYPE_RIDE, RouteSearch.RidingDefault);
}
 
Example 13
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 14
Source File: TraceActivity_Simple2222.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_trace_simple);
	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);// 此方法必须重写
	init();
}
 
Example 15
Source File: MarkerClickActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.marker_activity);
	/*
	 * 设置离线地图存储目录,在下载离线地图或初始化地图设置; 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
	 * 则需要在离线地图下载和使用地图页面都进行路径设置
	 */
	// Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
	// MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
	mapView = (MapView) findViewById(R.id.map);
	mapView.onCreate(savedInstanceState); // 此方法必须重写
	init();
}
 
Example 16
Source File: EventsActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.events_activity);
	/*
	 * 设置离线地图存储目录,在下载离线地图或初始化地图设置; 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
	 * 则需要在离线地图下载和使用地图页面都进行路径设置
	 */
	// Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
	// MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
	mapView = (MapView) findViewById(R.id.map);
	mapView.onCreate(savedInstanceState);// 此方法必须重写
	init();
}
 
Example 17
Source File: SmoothMoveActivity.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_smooth_move);

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

    init();
}
 
Example 18
Source File: LayersActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.layers_activity);
    /*
        * 设置离线地图存储目录,在下载离线地图或初始化地图设置;
        * 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
        * 则需要在离线地图下载和使用地图页面都进行路径设置
        * */
    //Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
      // MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
	mapView = (MapView) findViewById(R.id.map);
	mapView.onCreate(savedInstanceState);// 此方法必须重写
	init();
}
 
Example 19
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();

}
 
Example 20
Source File: IndoorMapActivity.java    From TraceByAmap with MIT License 4 votes vote down vote up
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.indoormap_activity);
	    /*
         * 设置离线地图存储目录,在下载离线地图或初始化地图设置;
         * 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
         * 则需要在离线地图下载和使用地图页面都进行路径设置
         * */
	    //Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
      //  MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
		mapView = (MapView) findViewById(R.id.map);
		mapView.onCreate(savedInstanceState);// 此方法必须重写


       /* //放置室内地图楼层控制控件
        floorSwitchView = new IndoorFloorSwitchView(this);

        ViewGroup.LayoutParams layoutParams =
                new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,400);

        List<String> list = new ArrayList<String>();
        list.add("F1");
        list.add("F2");
        list.add("F3");
//        list.add("F4");
//        list.add("F5");

        floorSwitchView.setItems(list);
        floorSwitchView.setSeletion("F2");

        addContentView(floorSwitchView, layoutParams);*/

        floorSwitchView = (IndoorFloorSwitchView) findViewById(R.id.indoor_switchview);

		init();


        // 设置楼层控制控件监听
        floorSwitchView.setOnIndoorFloorSwitchListener(new MyIndoorSwitchViewAdapter());


        // 设置室内地图回调监听
        aMap.setOnIndoorBuildingActiveListener(new AMap.OnIndoorBuildingActiveListener() {
            @Override
            public void OnIndoorBuilding(final IndoorBuildingInfo indoorBuildingInfo) {
                Log.i("amap", "indoor OnIndoorBuilding " + indoorBuildingInfo);
                if(indoorBuildingInfo != null) {
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
							floorSwitchView.setVisible(true);
                            //相同室内图,不需要替换楼层总数,只需要设置选中的楼层即可
							if(mIndoorBuildingInfo == null || !mIndoorBuildingInfo.poiid.equals(indoorBuildingInfo.poiid)) {
                                floorSwitchView
                                        .setItems(indoorBuildingInfo.floor_names);
								floorSwitchView
										.setSeletion(indoorBuildingInfo.activeFloorName);
                            }


                            mIndoorBuildingInfo = indoorBuildingInfo;
                        }
                    });
                } else {
					Log.i("amap", "indoor OnIndoorBuilding  indoor disappear");
					floorSwitchView.setVisible(false);
				}
            }
        });

		
		aMap.setOnMapLoadedListener(new OnMapLoadedListener() {
			
			@Override
			public void onMapLoaded() {
				// 室内地图默认不显示,这里把它设置成显示
				aMap.showIndoorMap(true);
                // 关闭SDK自带的室内地图控件
                aMap.getUiSettings().setIndoorSwitchEnabled(false);
				
				//移动到有室内地图的地方,放大级别才可以看见
				aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.91095, 116.37296), 19));
				
			}
		});
	}