private void initView(Bundle savedInstanceState) { station_mapview.onCreate(savedInstanceState); aMap = station_mapview.getMap(); aMap.setOnMarkerClickListener(this); aMap.setOnMarkerDragListener(this); aMap.setOnMapLoadedListener(this); aMap.setOnCameraChangeListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layers_activity); mapView = (MapView) findViewById(R.id.map); mapView.onCreate(savedInstanceState); // 此方法必须重写 init(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_poi_map); setupToolBar(); mapView = (MapView) findViewById(R.id.map); mapView.onCreate(savedInstanceState); aMap = mapView.getMap(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 在onCreat方法中给aMap对象赋值 setContentView(R.layout.activity_main); mapView = (MapView) findViewById(R.id.map); mapView.onCreate(savedInstanceState); // 必须要写 aMap = mapView.getMap(); initMap(); initMapButton(); initTitleButton(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_travel_planning); ActionBar actionBar = getSupportActionBar(); // 使用up 箭头指示器显示home actionBar.setDisplayHomeAsUpEnabled(true); // 设置title 文本 actionBar.setTitle("乐途记"); travelPlanningPresenter = new TravelPlanningPresenter(); travelPlanningPresenter.setView(this); mapView = (MapView) findViewById(R.id.map1); mapView.onCreate(savedInstanceState); init(); addMapListener(); // 向地图添加单击事件监听器 setUpMap(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.issue_gaodeditu); Intent intent = getIntent(); isChooseAddress = intent.getBooleanExtra("isChooseAddress", false); mapView = (MapView) findViewById(R.id.map); mapView.onCreate(savedInstanceState); // 此方法必须重写 sharedPreferences = getSharedPreferences(Constants.LOGIN_PREFERENCE, Context.MODE_PRIVATE); locationCity = sharedPreferences.getString("LocationCity", "北京"); getActionBar().setTitle(locationCity); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayShowHomeEnabled(true); init(); String LocationXStr = sharedPreferences.getString("LocationX", ""); String locationYStr = sharedPreferences.getString("LocationY", ""); if (isChooseAddress) { locationX = intent.getDoubleExtra("LocationX", 0.0); locationY = intent.getDoubleExtra("LocationY", 0.0); locationCity = intent.getStringExtra("LocationCityName"); latLng = new LatLng(locationX, locationY); latLonPoint = AMapUtil.convertToLatLonPoint(latLng); aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); // 设置当前地图显示为北京市恭王府 getAddress(latLonPoint); doSearchQuery(latLonPoint); regeoMarker.setPosition(latLng); } else { if (!TextUtils.isEmpty(LocationXStr) && !TextUtils.isEmpty(locationYStr)) { locationX = Double.parseDouble(LocationXStr); locationY = Double.parseDouble(locationYStr); latLng = new LatLng(locationX, locationY); latLonPoint = AMapUtil.convertToLatLonPoint(latLng); aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); getAddress(latLonPoint); doSearchQuery(latLonPoint); regeoMarker.setPosition(latLng); } } }