-
Navigation drawer SupportMapFragment
over 8 years ago
-
over 8 years ago
If you want to extends SupportMapFragment then you need to extends android.support.v4.app.Fragment insted of android.app.Fragment.
-
over 8 years ago
Sorry, im lost. Ill start over.
mapfragment.java This is the fragment, but now i dont really know how its should be build anymore. With the code you suggested. Im trying to use it in examples that i find on internet but i cant find any.
Like, this is what im trying to do right now
import com.google.android.gms.maps.GoogleMap; private SupportMapFragment map; private GoogleMap mMapView;
@Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); FragmentManager fm = getChildFragmentManager(); map = (SupportMapFragment) fm.findFragmentById(R.id.map); if (map == null) { map = SupportMapFragment.newInstance(); fm.beginTransaction().replace(R.id.map, map).commit(); } } @Override public void onResume() { super.onResume(); if (mMapView == null) { mMapView = map.getMap(); } }
-
-
over 8 years ago
Use Below code:-
(SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map_fragment).getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { mMap=googleMap; } });
and your mMap varibale is com.google.android.gms.googleMap.
-
-
over 8 years ago
mMap = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map));
This gives me an error, found 'com.google.android.gms.maps.SupportMapFragment, required 'com.google.android.gms.googleMap.
-
4 Answer(s)