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);
 }
Esempio n. 2
0
  @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();
  }
Esempio n. 3
0
  @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 onResume() {
   super.onResume();
   mapView.onResume();
   // 通知主导器,本view已经加载显示完毕
   travelPlanningPresenter.viewFinishLoading();
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.layers_activity);
   mapView = (MapView) findViewById(R.id.map);
   mapView.onCreate(savedInstanceState); // 此方法必须重写
   init();
 }
Esempio n. 6
0
 /** 初始花AMap对象 */
 private void initMap() {
   if (aMap == null) {
     aMap = mapView.getMap();
   }
   mapUisetting();
   mylocationsource = new MyLocationSource(this);
   aMap.setLocationSource(mylocationsource); // 设置定位资源
   aMap.setMyLocationEnabled(true); // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
   aMap.setInfoWindowAdapter(this); // 设置自定义InfoWindo 样式
   aMap.setOnInfoWindowClickListener(this); // 设置点击infowinfow事件监听器
   aMap.setOnMarkerClickListener(this); // 设置点击marker事件监听器
   aMap.setOnMapLongClickListener(this); // 长按地图事件监听器
 }
 /** 初始化AMap对象 */
 private void init() {
   if (aMap == null) {
     aMap = mapView.getMap();
   }
   CheckBox traffic = (CheckBox) findViewById(R.id.traffic);
   traffic.setOnClickListener(this);
   Spinner spinner = (Spinner) findViewById(R.id.layers_spinner);
   ArrayAdapter<CharSequence> adapter =
       ArrayAdapter.createFromResource(
           this, R.array.layers_array, android.R.layout.simple_spinner_item);
   adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   spinner.setAdapter(adapter);
   spinner.setOnItemSelectedListener(this);
 }
  @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();
  }
Esempio n. 9
0
 @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);
     }
   }
 }
Esempio n. 10
0
  /** 初始化AMap对象 */
  private void init() {
    if (aMap == null) {
      aMap = mapView.getMap();
      // aMap.setOnMapClickListener(this);
      aMap.setOnCameraChangeListener(this);
      aMap.setOnMarkerClickListener(this); // 添加点击marker监听事件
      aMap.setInfoWindowAdapter(this); // 添加显示infowindow监听事件
      regeoMarker =
          aMap.addMarker(
              new MarkerOptions()
                  .anchor(0.5f, 0.5f)
                  .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
    }
    ;
    geocoderSearch = new GeocodeSearch(this);
    geocoderSearch.setOnGeocodeSearchListener(this);
    progDialog = new ProgressDialog(this);
    mListView = (ListView) this.findViewById(R.id.map_listview);
    mSpinner = (Spinner) this.findViewById(R.id.map_spinner);
    ArrayAdapter<String> mAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, itemDeep);
    mSpinner.setAdapter(mAdapter);
    mSearchAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mSearchList);
    mListView.setAdapter(mSearchAdapter);
    mListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String name = mSearchList.get(position);
            address = address + " - " + name;
            backToIssue();
          }
        });
    addressTv = (TextView) this.findViewById(R.id.gaode_address);
  }
Esempio n. 11
0
 /** 方法必须重写 */
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   mapView.onSaveInstanceState(outState);
 }
Esempio n. 12
0
 @Override
 protected void onResume() {
   super.onResume();
   mapView.onResume();
 }
Esempio n. 13
0
 @Override
 protected void onPause() {
   super.onPause();
   mapView.onPause();
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   station_mapview.onDestroy();
 }
 @Override
 protected void onPause() {
   super.onPause();
   station_mapview.onPause();
 }
 @Override
 protected void onResume() {
   super.onResume();
   station_mapview.onResume();
 }
 /** 方法必须重写 */
 @Override
 protected void onDestroy() {
   super.onDestroy();
   mapView.onDestroy();
 }
 /** 初始化AMap 对象 */
 private void init() {
   if (aMap == null) {
     aMap = mapView.getMap();
   }
 }