I'm creating an Android application in Eclipse with 3 screen with horizontal Swipe, on the last tab I have a Map Fragment.
But it happens that when doing swipe to the right the first time everything is normal, when making a swipe to the left and to make a right to the application crash again and appears to me this error, what could be? / p>
Thank you in advance
07-29 23:35:38.279: E/AndroidRuntime(10353): FATAL EXCEPTION: main
07-29 23:35:38.279: E/AndroidRuntime(10353): Process: com.sapires.JoesPizzariaGEN, PID: 10353
07-29 23:35:38.279: E/AndroidRuntime(10353): android.view.InflateException: Binary XML file line #8: Error inflating class fragment
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
07-29 23:35:38.279: E/AndroidRuntime(10353): at com.sapires.JoesPizzaria.Mapa.onCreateView(Mapa.java:16)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1504)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:482)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.support.v4.view.ViewPager$3.run(ViewPager.java:249)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.Choreographer.doCallbacks(Choreographer.java:603)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.Choreographer.doFrame(Choreographer.java:572)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.os.Handler.handleCallback(Handler.java:733)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.os.Handler.dispatchMessage(Handler.java:95)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.os.Looper.loop(Looper.java:136)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.app.ActivityThread.main(ActivityThread.java:5579)
07-29 23:35:38.279: E/AndroidRuntime(10353): at java.lang.reflect.Method.invoke(Native Method)
07-29 23:35:38.279: E/AndroidRuntime(10353): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
07-29 23:35:38.279: E/AndroidRuntime(10353): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
07-29 23:35:38.279: E/AndroidRuntime(10353): Caused by: java.lang.IllegalArgumentException: Binary XML file line #8: Duplicate id 0x7f070016, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.MapFragment
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.app.Activity.onCreateView(Activity.java:5002)
07-29 23:35:38.279: E/AndroidRuntime(10353): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
07-29 23:35:38.279: E/AndroidRuntime(10353): ... 25 more
Layout of Fragment
Map
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<fragment
android:id="@+id/fragment"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</LinearLayout>
Class
package com.sapires.JoesPizzaria;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
public class TabPagerAdapter extends FragmentStatePagerAdapter {
public TabPagerAdapter(FragmentManager fm) {
super(fm);
// TODO Auto-generated constructor stub
}
@Override
public Fragment getItem(int i) {
switch (i) {
case 0:
return new APizzaria();
case 1:
return new Ementa();
case 2:
return new Mapa();
}
return null;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return 3; //No of Tabs
}
}