Hi, I have a problem pressing an option in my navigationView (R.id.create_marker) I want to create a marker in my MapFragment but I can not do it, any suggestions?
MainActivity.java code where I press the menu option:
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.create_marker:
Toast.makeText(MainActivity.this, "Crear Marker", Toast.LENGTH_SHORT).show();
// Crear marcador y mostrarlo en el mapa
break;
}
return false;
}
});
The MapFragment.java code is the default code when creating the Google Maps layout, adapted to use Fragments.
This is the structure of my project: