0

I searched a lot in Google about this and in Android documentation and until now i didnt find a way to do this. is there a solution to call a context menu over a map fragment?

This is part of my MapActivity:

        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.layout_maps);
            setUpMapIfNeeded();
            View v = findViewById(R.id.map); // not sure about this part
            registerForContextMenu(v);

    }


    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo info){
        super.onCreateContextMenu(menu,v,info);
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_contextual, menu);

}

    public boolean onContextItemSelected(MenuItem item) {
        switch (item.getItemId()){
            case R.id.needHelp:

                return true;
            case R.id.giveHelp:

                return true;
            default:
                return super.onContextItemSelected(item);
        }
    }

//this one is my Fragment Layout 
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/map"
        tools:context=".MapsActivity"
        android:name="com.google.android.gms.maps.SupportMapFragment"/>
Catluc
  • 1,775
  • 17
  • 25

0 Answers0