Back to project page storage_room_android_example.
The source code is released under:
Copyright (c) 2011 Till Simon http://www.tillsimon.com mail@tillsimon.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation f...
If you think the Android project storage_room_android_example listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.tillsimon.storageroom_example.activities.maphelper; /*ww w. ja v a2 s . c o m*/ import java.util.ArrayList; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import com.google.android.maps.MapView; import com.google.android.maps.OverlayItem; import com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay; import com.tillsimon.storageroom_example.activities.RestaurantDetailActivity; public class RestaurantsOverlay extends BalloonItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> mOverlayItemsArrayList = new ArrayList<OverlayItem>(); private Context mContext; public RestaurantsOverlay(Context context, Drawable defaultMarker, MapView mapView) { super(boundCenter(defaultMarker), mapView); this.mContext = context; } @Override protected boolean onBalloonTap(int index, OverlayItem item) { Intent intent = new Intent(mContext, RestaurantDetailActivity.class); intent.putExtra("clickedItemId", ((RestaurantOverlayItem)item).getId()); mContext.startActivity(intent); return true; } @Override protected OverlayItem createItem(int i) { return mOverlayItemsArrayList.get(i); } @Override public int size() { return mOverlayItemsArrayList.size(); } @Override public void hideBalloon() { super.hideBalloon(); } public void addOverlayItem(OverlayItem overlay) { mOverlayItemsArrayList.add(overlay); populate(); } }