I need to embed aSupportMapFragment
in aDialog
. This is the best I could think of:
public class SupportMapFragmentDialog extends DialogFragment {
private final SupportMapFragment fragment;
public SupportMapFragmentDialog() {
fragment = new SupportMapFragment();
setTargetFragment(fragment, 1);
}
@Override
public View onCreateView(final LayoutInflater inflater,
final ViewGroup container, final Bundle savedInstanceState) {
return fragment.onCreateView(inflater, container, savedInstanceState);
}
public SupportMapFragment getFragment() {
return fragment;
}
}
However, when I call this:
final SupportMapFragmentDialog dialog = new SupportMapFragmentDialog();
dialog.show(getSupportFragmentManager(), "Historico");
I get this:
What can I do to see the map on the Dialog?
The app has another SupportMapFragment
that is working wonders, so it doesn't have anything to do with the configuration.
You can show a map fragment in a dialog by this
R.layout.mapdialog:
In the end I ended up using
MapView
in a regularDialog
instead ofSupportMapFragment
This is my code:
And it works as intended.