Reputation: 13
why is it i could not cast the Fragment to SupportMapFragment.here is the code
googleMap = ((SupportMapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
here is my activity_main.xml
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Upvotes: 0
Views: 180
Reputation: 10358
It should be getSupportFragmentManager(). Make sure that your Activity extends FragmentActivity for ActionBarActivity from the support package.
googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(
R.id.map)).getMap();
Upvotes: 2