Android: <include/> layout crashes application on landscape -
i tried use include tag reuse layout code activity_main.xml , contact_details.xml during landscape mode. display activity_main on left , contact_details on right. application crashes when switch landscape mode.
this coding activity_main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <listview android:id="@+id/list_data" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" /> <button android:id="@+id/btnaddcontact" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="5dp" android:layout_weight="0" android:text="add contact" /> </linearlayout>
this coding contact_details.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <listview android:id="@+id/lvcontactdetails" android:layout_width="match_parent" android:layout_height="wrap_content" > </listview> </linearlayout>
this coding layout-land/activity_main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <include layout="@layout/activity_main"/> <view android:layout_width="1dp" android:layout_height="fill_parent" android:background="#a3a3a3"/> <include layout="@layout/contact_details"/> </linearlayout>
any tips resolving problem? in advance.
thanks adinia suggestion. because should not call same layout name, activity_main.xml. main cause of crash. might circular reference adinia had stated. again. way, allowed accept answer in 2 days.
Comments
Post a Comment