I'm testing the some of the sensors available, and i display the values of each sensor in a textview.
But When I enclosed all the textviews inside a scrollView the App crashed.
Note: my scrollView is already enclosed inside a linearLayout
Please find below the .xml file.
XML:
<ScrollView
android:isScrollContainer="true"
android:scrollbars="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/accelerometer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Accelerometer " />
<TextView
android:id="@+id/acc_tv01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="X = " />
<TextView
android:id="@+id/acc_tv01Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/acc_tv02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Y = " />
<TextView
android:id="@+id/acc_tv02Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/acc_tv03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Z = " />
<TextView
android:id="@+id/acc_tv03Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/Orientation"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Orientation " />
<TextView
android:id="@+id/orient_tv01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="X = " />
<TextView
android:id="@+id/orient_tv01Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/orient_tv02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Y = " />
<TextView
android:id="@+id/orient_tv02Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/orient_tv03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Z = " />
<TextView
android:id="@+id/orient_tv03Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/Magnetometer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Magnetometer " />
<TextView
android:id="@+id/magnet_tv01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="X = " />
<TextView
android:id="@+id/magnet_tv01Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/magnet_tv02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Y = " />
<TextView
android:id="@+id/magnet_tv02Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/magnet_tv03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Z = " />
<TextView
android:id="@+id/magnet_tv03Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/Gyroscope"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Gyroscope " />
<TextView
android:id="@+id/gyro_tv01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="X = " />
<TextView
android:id="@+id/gyro_tv01Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/gyro_tv02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Y = " />
<TextView
android:id="@+id/gyro_tv02Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/gyro_tv03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Z = " />
<TextView
android:id="@+id/gyro_tv03Value"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>