I am trying to create a SupportMapFragment inside a fragment..I get the following error:
The method SupportFragmentManager() is undefined for the type MapFragment
my code is as follows:
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.GoogleMap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
public class MapFragment extends Fragment{
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.fragment_map_view, container, false);
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
DateTimeFragment datetime=new DateTimeFragment();
ft.add(R.id.datetime_container_map, datetime);
SupportMapFragment mapFragment = (SupportMapFragment)SupportFragmentManager().findFragmentById(R.id.map_fragment);
return v;
}
}
However, SupportMapFragmentManager does not resolve. What is the solution to this problem?