I’m trying to make footer for my fragment. I succeed to do it but still have a problem when I load this fragment for the first time it's work well, but when I change the fragments in my navigation drawer and trying to get this fragment for the second time the app crash and the log error show me an error :
android.view.InflateException: Binary XML file line #17: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
Caused by: java.lang.IllegalArgumentException: Binary XML file line #17:
Duplicate id 0x7f070084, tag null, or parent id 0x7f070082 with another fragment for com.example.user.unchained.FooterHome
So any one have an idea to resolve the problem
The OnCreateView
Function :
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
v = inflater.inflate(R.layout.fragment_homes, container, false);
listView = (ListView) v.findViewById(R.id.homeList);
l = new HomeListAdapter(this, homeList);
listView.setAdapter(l);
return v;
}
The main Layout XML :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dark_grey"
android:id="@+id/fHome"
tools:context="com.example.user.unchained.HomesActivity$PlaceholderFragment">
<ListView
android:id="@+id/homeList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dp"
android:choiceMode="singleChoice"
android:listSelector="@drawable/list_row_selector" />
<fragment
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:name="com.example.user.unchained.FooterHome"
android:layout_alignParentBottom="true"
android:id="@+id/foo"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
tools:layout="@layout/footer_home" />
</RelativeLayout>
The Footer Layout XML.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#272822"
android:id="@+id/homeFooter"
tools:context="com.example.user.unchained.FooterHome">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="What's New ?"
android:textSize="16dip"
android:layout_marginTop="12dip"
android:layout_marginLeft="10dip"
android:drawableLeft="@drawable/status"
android:id="@+id/watsN"
android:textColor="@color/connexion_button"
android:layout_gravity="left|top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=" | "
android:textSize="25dip"
android:layout_marginTop="6dip"
android:layout_marginLeft="145dip"
android:textColor="@color/connexion_button"
android:layout_gravity="left|top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Check In"
android:textSize="16dip"
android:layout_marginTop="12dip"
android:layout_marginLeft="165dip"
android:drawableLeft="@drawable/checkin"
android:id="@+id/checkIn"
android:textColor="@color/connexion_button"
android:layout_gravity="left|top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=" | "
android:textSize="25dip"
android:layout_marginTop="6dip"
android:layout_marginLeft="265dip"
android:textColor="@color/connexion_button"
android:layout_gravity="left|top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=" Picture"
android:textSize="16dip"
android:layout_marginTop="12dip"
android:layout_marginLeft="290dip"
android:drawableLeft="@drawable/camera"
android:id="@+id/postPic"
android:textColor="@color/connexion_button"
android:layout_gravity="left|top" />
</FrameLayout>