0

I am creating an application with Google Maps, Fragment and View Pager.

But I got the following error:

02-06 11:56:58.421: E/AndroidRuntime(1675): FATAL EXCEPTION: main

02-06 11:56:58.421: E/AndroidRuntime(1675): android.view.InflateException: Binary XML file line #246: Error inflating class fragment

02-06 11:56:58.421: E/AndroidRuntime(1675):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)**

in the line:

**v = inflater.inflate(R.layout.detalle_mon_fragment, container, false);**

This is my code:

DetalleMonumentoFragment.java

public class ActivityFragment extends Fragment implements OnClickListener {  

    public static final ActivityFragment newInstance(String mon){

        ActivityFragment f = new ActivityFragment();
        Bundle bdl = new Bundle(1);

        bdl.putString("mon", mon);
        f.setArguments(bdl);
        return f;
    }

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){

    context = getActivity();

    mon = getArguments().getString("mon");

    v = inflater.inflate(R.layout.detalle_mon_fragment, container, false);
...
}

detalle_mon_fragment.xml

<LinearLayout
                android:id="@+id/tab4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:paddingTop="5dp" >

                <fragment
                    android:id="@+id/mapaTab"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    class="com.google.android.gms.maps.SupportMapFragment"/>
            </LinearLayout>

What can be the error? thanks

EDIT:

New error now:

02-06 12:15:42.242: E/AndroidRuntime(1965): Caused by: java.lang.IllegalArgumentException: Binary XML file line #246: Duplicate id 0x7f060039, tag null, or parent id 0x0 with another fragment for com.google.android.gms.maps.SupportMapFragment

    public static final int mapa2=0x7f060051;
    public static final int mapaMain=0x7f060013;
    public static final int mapaTab=0x7f060039;

I have a Activity with a Map and onClick open other Map.

1 Answers1

0

Try

  <fragment
            android:id="@+id/mapaTab"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:name="com.google.android.gms.maps.SupportMapFragment"/>
M. Bongini
  • 122
  • 6