Error Using Maps In Fragment
i am having this error when i try to open my fragment 'activityMapa', apparently can't inflate my xml file: 11-15 21:58:39.769: E/AndroidRuntime(2432): FATAL EXCEPTION: main 11-15
Solution 1:
Create a class that derives from SupportMapFragment, and you won't need to inflate a layout.
public class MyMapFragment extends SupportMapFragment {
private GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
map = getMap();
}
Then, when you need to use this in your activity's layout, you'd reference your class within the activity's layout xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.example.despegarteproject.MyMapFragment" />
Post a Comment for "Error Using Maps In Fragment"