Don't know if this will help anyone , but here is a little trick i found to use contextual menu on a map view.
Just extend the CustomMapView , use the onlongPress to display the contextual menu instead of the zoom dialog.
use this wiew in xml :
Using xml Syntax Highlighting
- <view class="com.piggyBack.uii.CustomMapView"
- android:id="@+id/map" android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
Using java Syntax Highlighting
- public class CustomMapView extends MapView {
- public static final String TAG="CustomMapView";
- public CustomMapView(Context context, AttributeSet attrs, Map inflateParams) {
- super(context, attrs, inflateParams);
- // TODO Auto-generated constructor stub
- }
- public CustomMapView(Context context) {
- super(context);
- // TODO Auto-generated constructor stub
- }
- /* (non-Javadoc)
- * @see com.google.android.maps.MapView#onLongPress(float, float)
- */
- @Override
- public boolean onLongPress(float x, float y) {
- getParent().showContextMenuForChild(this);
- return true;
- }
- /* (non-Javadoc)
- * @see android.view.View#onFinishInflate()
- */
- @Override
- protected void onFinishInflate() {
- // TODO Auto-generated method stub
- super.onFinishInflate();
- setFocusableInTouchMode(true);
- }
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


