I build my app with API17 as target and minSDK 12 now I have to make the app works on andorid.2.2 (API8) devices I chang the minSDK to 8 and the target SDK to 8 also I fix some errors but I don't know how to fix this
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
(error : getFragmentManager() is undefined )
how to use google map v2
I added these to the Activity
import android.support.v4.app.* ;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.FragmentManager;
what else should I do to fix this ??
You class must extend FragmentActivity
. Make sure you have added support library.
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mMap = fm.getMap();
Also in your xml
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Also make sure you have imported
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
Try using getSupportFragmentManager()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With