I am developing an app that use fragments. One of my fragments i want to use google map but i am getting errors.
public class Map extends Fragment {
public Map() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
GoogleMap map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
//Error:(38, 84) error: inconvertible types
//required: SupportMapFragment
//found: Fragment
return inflater.inflate(R.layout.fragment_map, container, false);
}
}
When i trying to cast map fragment i am getting the error in comment. What should i do to solve this? Thanks for everyone. Edit: the layout ;
<fragment
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment" />