Java Code Examples for com.amap.api.services.geocoder.GeocodeSearch#setOnGeocodeSearchListener()

The following examples show how to use com.amap.api.services.geocoder.GeocodeSearch#setOnGeocodeSearchListener() . 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: ReGeocoderActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 初始化AMap对象
 */
private void init() {
	if (aMap == null) {
		aMap = mapView.getMap();
		regeoMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
		aMap.setOnMarkerClickListener(this);
	}
	Button regeoButton = (Button) findViewById(R.id.geoButton);
	Button regeoButton_ = (Button)findViewById(R.id.regeoButton);
	regeoButton.setText("ResGeoCoding(39.90865,116.39751)");
	regeoButton.setOnClickListener(this);
	regeoButton_.setVisibility(View.VISIBLE);
	regeoButton_.setText("逆地理编码同步方法(线程池)");
	regeoButton_.setOnClickListener(this);
	geocoderSearch = new GeocodeSearch(this);
	geocoderSearch.setOnGeocodeSearchListener(this);
	progDialog = new ProgressDialog(this);
}
 
Example 2
Source File: AmapActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
private void initAmap() {
        if (aMap == null) {
            aMap = mapView.getMap();
        }
        aMap.setLocationSource(this);// 设置定位监听
        aMap.setMyLocationEnabled(true);
        aMap.getUiSettings().setZoomControlsEnabled(false);

//        aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
        CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(15);
        aMap.moveCamera(cameraUpdate);

        movingDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.icon_loaction_choose_moving);
        chooseDescripter = BitmapDescriptorFactory.fromResource(R.drawable.icon_loaction_choose);
        successDescripter = BitmapDescriptorFactory.fromResource(R.drawable.icon_usecarnow_position_succeed);

        geocodeSearch = new GeocodeSearch(this);
        geocodeSearch.setOnGeocodeSearchListener(this);
    }
 
Example 3
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 6 votes vote down vote up
private void initMap() {
    aMap = mMapView.getMap();
    mUiSettings = aMap.getUiSettings();
    mUiSettings.setZoomControlsEnabled(false);
    mUiSettings.setScaleControlsEnabled(true);
    mUiSettings.setMyLocationButtonEnabled(false);

    //焊死位置,未得许可不能更改
    if (canSelect||AccountModel.getInstance().checkIsSuper()){
        aMap.setOnMapClickListener(this);
    }
    aMap.setOnMarkerClickListener(this);
    mGeocoderSearch = new GeocodeSearch(this);
    mGeocoderSearch.setOnGeocodeSearchListener(this);
    initMyPoint();
}
 
Example 4
Source File: MapActivity.java    From xposed-rimet with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_map);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true);

    mMapView = findViewById(R.id.map_view);
    mMapView.onCreate(savedInstanceState);

    mListView = findViewById(R.id.list_view);
    mTvPrompt = findViewById(R.id.tv_prompt);
    mSearchResultAdapter = new SearchResultAdapter(this);
    mListView.setAdapter(mSearchResultAdapter);
    mListView.setOnItemClickListener(this);

    mAMap = mMapView.getMap();

    mAMap.getUiSettings().setZoomControlsEnabled(false);
    mAMap.setLocationSource(this);
    mAMap.getUiSettings().setMyLocationButtonEnabled(true);
    mAMap.setMyLocationEnabled(true);

    mAMap.setOnCameraChangeListener(new MyOnCameraChangeListener());
    mAMap.setOnMapLoadedListener(new MyOnMapLoadedListener());

    mGeocodeSearch = new GeocodeSearch(getApplicationContext());
    mGeocodeSearch.setOnGeocodeSearchListener(new MyOnGeocodeSearchListener());

    // 请求权限
    PermissionUtil.requestPermissions(this,
            new String[] {
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
                    Manifest.permission.ACCESS_FINE_LOCATION},
            99);
}
 
Example 5
Source File: FlutterAMapConvertRegister.java    From flutter_amap_plugin with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
    geocoderSearch = new GeocodeSearch(FlutterAmapPlugin.registrar.activity().getApplicationContext());
    geocoderSearch.setOnGeocodeSearchListener(this);
    if (methodCall.method.equals("geoToCoordinate")) {
        if (methodCall.arguments instanceof String) {
            geoConvertToCoordinate(methodCall.arguments.toString());
        }
    } else if (methodCall.method.equals("coordinateToGeo")) {
        if (methodCall.arguments instanceof String) {
            Coordinate model = new Gson().fromJson(methodCall.arguments.toString(), Coordinate.class);
            coordinateConvertToGeo(model);
        }
    }
}
 
Example 6
Source File: GeocoderActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 初始化AMap对象
 */
private void init() {
	if (aMap == null) {
		aMap = mapView.getMap();
		geoMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
	}
	Button geoButton = (Button) findViewById(R.id.geoButton);
	geoButton.setText("GeoCoding(北京市朝阳区方恒国际中心A座)");
	geoButton.setOnClickListener(this);
	geocoderSearch = new GeocodeSearch(this);
	geocoderSearch.setOnGeocodeSearchListener(this);
	progDialog = new ProgressDialog(this);
}
 
Example 7
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
@Override
public void onMyLocationChange(Location location) {
    LogUtil.e(TAG, "onMyLocationChange");
    GeocodeSearch geocoderSearch = new GeocodeSearch(getContext());
    geocoderSearch.setOnGeocodeSearchListener(this);
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    aMap.moveCamera(CameraUpdateFactory.changeLatLng(latLng));
    LatLonPoint latLonPoint = new LatLonPoint(location.getLatitude(), location.getLongitude());
    RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 10000, GeocodeSearch.AMAP);
    geocoderSearch.getFromLocationAsyn(query);
}
 
Example 8
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
/**
 * 由城市名查询地理位置
 * @param address 地址
 * @param name 城市名字
 */
private void doSearchGeo(String address, String name) {
    GeocodeSearch geocoderSearch = new GeocodeSearch(getContext());
    geocoderSearch.setOnGeocodeSearchListener(this);
    GeocodeQuery query = new GeocodeQuery(address, name);
    geocoderSearch.getFromLocationNameAsyn(query);
}
 
Example 9
Source File: AMAPLocationActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
private void initAmap() {
    if (aMap == null) {
        aMap = mapView.getMap();
    }

    if (getIntent().hasExtra("location")) {
        isPerview = true;
        mMsg = getIntent().getParcelableExtra("location");
        tvCurLocation.setVisibility(View.GONE);
        returns.setVisibility(View.GONE);

        if (model) {
            CameraPosition location = new CameraPosition.Builder()
                    .target(new LatLng(mMsg.getLat(), mMsg.getLng())).zoom(18).bearing(0).tilt(30).build();
            show(location);
        } else {
            aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
                    .position(new LatLng(mMsg.getLat(), mMsg.getLng())).title(mMsg.getPoi())
                    .snippet(mMsg.getLat() + "," + mMsg.getLng()).draggable(false));
        }
        return;
    }


    aMap.setLocationSource(this);// 设置定位监听
    aMap.setMyLocationEnabled(true);
    aMap.getUiSettings().setZoomControlsEnabled(false);
    aMap.getUiSettings().setMyLocationButtonEnabled(false);
    CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(15);//设置缩放监听
    aMap.moveCamera(cameraUpdate);

    successDescripter = BitmapDescriptorFactory.fromResource(R.drawable.icon_usecarnow_position_succeed);
    geocodeSearch = new GeocodeSearch(this);
    geocodeSearch.setOnGeocodeSearchListener(this);
}
 
Example 10
Source File: WritePresenter.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(WriteActivity view, Bundle savedState) {
    super.onCreate(view, savedState);
    provider = new ImageProvider(getView());
    mGeocoderSearch = new GeocodeSearch(getView());
    mGeocoderSearch.setOnGeocodeSearchListener(this);
    location = LocationModel.getInstance().getCurLocation();
    if (location != null) {
        mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP));
    }
}
 
Example 11
Source File: RegeocodeTask.java    From Android_UsingCar_Example with Apache License 2.0 4 votes vote down vote up
public RegeocodeTask(Context context) {
	mGeocodeSearch = new GeocodeSearch(context);
	mGeocodeSearch.setOnGeocodeSearchListener(this);
}