Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

 4 Answer(s)

  • 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();
    
    
        }
    }
    
  • 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.

  • 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.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: