Java Code Examples for com.amap.api.maps.model.Marker#getTitle()

The following examples show how to use com.amap.api.maps.model.Marker#getTitle() . 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: CustomMarkerActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 监听拖动marker时事件回调
 */
@Override
public void onMarkerDrag(Marker marker) {
	String curDes = marker.getTitle() + "拖动时当前位置:(lat,lng)\n("
			+ marker.getPosition().latitude + ","
			+ marker.getPosition().longitude + ")";
	markerText.setText(curDes);
}
 
Example 2
Source File: CustomMarkerActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 自定义infowinfow窗口
 */
public void render(Marker marker, View view) {
	if (radioOption.getCheckedRadioButtonId() == R.id.custom_info_contents) {
		((ImageView) view.findViewById(R.id.badge))
				.setImageResource(R.drawable.badge_sa);
	} else if (radioOption.getCheckedRadioButtonId() == R.id.custom_info_window) {
		ImageView imageView = (ImageView) view.findViewById(R.id.badge);
		imageView.setImageResource(R.drawable.badge_wa);
	}
	String title = marker.getTitle();
	TextView titleUi = ((TextView) view.findViewById(R.id.title));
	if (title != null) {
		SpannableString titleText = new SpannableString(title);
		titleText.setSpan(new ForegroundColorSpan(Color.RED), 0,
				titleText.length(), 0);
		titleUi.setTextSize(15);
		titleUi.setText(titleText);

	} else {
		titleUi.setText("");
	}
	String snippet = marker.getSnippet();
	TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));
	if (snippet != null) {
		SpannableString snippetText = new SpannableString(snippet);
		snippetText.setSpan(new ForegroundColorSpan(Color.GREEN), 0,
				snippetText.length(), 0);
		snippetUi.setTextSize(20);
		snippetUi.setText(snippetText);
	} else {
		snippetUi.setText("");
	}
}
 
Example 3
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    if (mIsModeRanging) {
        MyPoiModel poi = new MyPoiModel(TypeMap.TYPE_AMAP);
        poi.setLatitude(marker.getPosition().latitude);
        poi.setLongitude(marker.getPosition().longitude);

        mPoiList.add(poi);

        makeRangingMarker(poi);
        setRangingPolyLine();
    } else {
        int distance = 0;
        if (null != BApp.MY_LOCATION) {
            distance = (int) AMapUtils.calculateLineDistance(new LatLng(BApp.MY_LOCATION.getLatitude(), BApp.MY_LOCATION.getLongitude()), marker.getPosition());
        }

        if (null == clickMapPoiNow) {
            clickMapPoiNow = new MyPoiModel(TypeMap.TYPE_AMAP);
        }
        if (null != marker.getTitle() && !marker.getTitle().isEmpty()) {
            clickMapPoiNow.setTypeMap(TypeMap.TYPE_AMAP);
            clickMapPoiNow.setName(marker.getTitle());
            clickMapPoiNow.setLongitude(marker.getPosition().longitude);
            clickMapPoiNow.setLatitude(marker.getPosition().latitude);
            mAmap.animateCamera(CameraUpdateFactory.changeLatLng(new LatLng(clickMapPoiNow.getLatitude(), clickMapPoiNow.getLongitude())));
            ((MainActivity) getActivity()).showPoiLay(clickMapPoiNow, distance);
        } else {
            ((MainActivity) getActivity()).showPoiLay(BApp.MY_LOCATION, distance);
        }

    }
    return true;
}
 
Example 4
Source File: RouteAmapBusActivity.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    if (null == marker.getTitle() || marker.getTitle().isEmpty() || null == marker.getSnippet() || marker.getSnippet().isEmpty()) {
        return true;
    }
    showAlertDialog(marker.getTitle(), marker.getSnippet(), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    }, null);
    return true;
}
 
Example 5
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    if (mIsModeRanging) {
        MyPoiModel poi = new MyPoiModel(TypeMap.TYPE_AMAP);
        poi.setLatitude(marker.getPosition().latitude);
        poi.setLongitude(marker.getPosition().longitude);

        mPoiList.add(poi);

        makeRangingMarker(poi);
        setRangingPolyLine();
    } else {
        int distance = 0;
        if (null != BApp.MY_LOCATION) {
            distance = (int) AMapUtils.calculateLineDistance(new LatLng(BApp.MY_LOCATION.getLatitude(), BApp.MY_LOCATION.getLongitude()), marker.getPosition());
        }

        if (null == clickMapPoiNow) {
            clickMapPoiNow = new MyPoiModel(TypeMap.TYPE_AMAP);
        }
        if (null != marker.getTitle() && !marker.getTitle().isEmpty()) {
            clickMapPoiNow.setTypeMap(TypeMap.TYPE_AMAP);
            clickMapPoiNow.setName(marker.getTitle());
            clickMapPoiNow.setLongitude(marker.getPosition().longitude);
            clickMapPoiNow.setLatitude(marker.getPosition().latitude);
            mAmap.animateCamera(CameraUpdateFactory.changeLatLng(new LatLng(clickMapPoiNow.getLatitude(), clickMapPoiNow.getLongitude())));
            ((MainActivity) getActivity()).showPoiLay(clickMapPoiNow, distance);
        } else {
            ((MainActivity) getActivity()).showPoiLay(BApp.MY_LOCATION, distance);
        }

    }
    return true;
}
 
Example 6
Source File: RouteAmapBusActivity.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    if (null == marker.getTitle() || marker.getTitle().isEmpty() || null == marker.getSnippet() || marker.getSnippet().isEmpty()) {
        return true;
    }
    showAlertDialog(marker.getTitle(), marker.getSnippet(), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    }, null);
    return true;
}
 
Example 7
Source File: CloudActivity.java    From TraceByAmap with MIT License votes vote down vote up
@Override
	public void onInfoWindowClick(Marker arg0) {
		String tile = arg0.getTitle();
		for (CloudItem item : items) {
			if (tile.equals(item.getTitle())) {
				Intent intent = new Intent(CloudActivity.this, CloudDetailActivity.class);
				intent.putExtra("clouditem", item);
				startActivity(intent);
				break;
			}

		}
	}