Reputation: 307
i have the following code and i am using sherlockfragments.
map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="450px"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
and i am getting error:
android.view.InflateException: Binary XML file line #94: Error inflating class fragment
Upvotes: 1
Views: 4189
Reputation: 143
Try removing the getActivity()..
map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
just try with change by:
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
It did worked for me ...hope it would do for you also
Upvotes: 1
Reputation: 2104
try yo use this:
private GoogleMap MAP;
FragmentManager myFM = getSupportFragmentManager();
SupportMapFragment myMAPF = (SupportMapFragment) myFM
.findFragmentById(R.id.map);
MAP = myMAPF.getMap();
Also you have to change it with:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="450px"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
to
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="450px"
class="com.google.android.gms.maps.SupportMapFragment"/>
Upvotes: 1
Reputation: 307
Resolved Thanks to all for your suggestions.
<Meta> Tag should be in <Application> Tag.
Upvotes: 4