对于我在学校的项目,我必须制作一个可以在整个学校进行游览的应用程序。现在,我想使我的地图上的标记可点击,并使它们通过POI的信息进入不同的活动。我知道onmarkerListeners和意图,但我不知道如何实现。
public void onmapReady(GoogleMap googleMap) {
int height = 100;
int width = 100;
BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.drawable.marker);
Bitmap b=bitmapdraw.getBitmap();
Bitmap smallMarker = Bitmap.createScaledBitmap(b,width,height,false);
mMap = googleMap;
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
LatLng HalA = new LatLng(50.8062795,3.2922986);
LatLng stuvo = new LatLng(50.8061347,3.2920485);
LatLng bib = new LatLng(50.8062763,3.2919120);
LatLng acco = new LatLng(50.8063492,3.2925983);
还有更多的兴趣点,但这无关紧要。以下代码是我将标记放置在地图上的方式。
googleMap.addMarker(new MarkerOptions().position(HalA)
.title("Hal A")
.icon(BitmapDescriptorFactory.fromBitmap(smallMarker)));
googleMap.addMarker(new MarkerOptions().position(stuvo)
.title("Stuvo")
.icon(BitmapDescriptorFactory.fromBitmap(smallMarker)));
,依此类推。我必须在哪里放置onmarkerListener?我是否必须将所有内容都放在onCreate中?我必须更改什么?