• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps getFragmentManager to fragment

Xpakz

Lurker
I am trying to convert an activity to a fragment and have problems with getFragmentManager.

my xml code:

Code:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/map"
    tools:context="xpak.xparking.MapsFragment"
    class ="com.google.android.gms.maps.SupportMapFragment" />

and my java file where the error is:

Java:
 private void setUpMapIfNeeded() {
       
        if (mMap == null) {
          SupportMapFragment.
           mMap = ((SupportMapFragment) [B]getFragmentManager()[/B].findFragmentById(R.id.map))
                    .getMap();

            if (mMap != null) {
                setUpMap();
            }
        }
    }

this extends Fragment

i rlly need ur help , and im sorry for my english.
 
Back
Top Bottom