• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Create multiple table row

Dear Team,

I want to create multiple table rows as shown in the picture. The total no of rows is 250. how to create these 250 rows through the java program.

HTML:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".Aggre20_Ascending" >



    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp">


        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp">

            <TextView
                android:id="@+id/textView1"
                android:layout_width="110dp"
                android:layout_height="45dp"
                android:background="@drawable/border"
                android:padding="5dp"
                android:textAlignment="center"
                android:text="Actual          Weight"
                android:textStyle="bold"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:textSize="15sp">

            </TextView>

            <TextView
                android:id="@+id/editText1"
                android:layout_width="110dp"
                android:layout_height="45dp"
                android:background="@drawable/border"
                android:padding="5dp"
                android:text="Meter     Reading"
                android:textStyle="bold"
                android:textAlignment="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:textSize="15dp">

            </TextView>

            <TextView
                android:id="@+id/error1"
                android:layout_width="110dp"
                android:layout_height="45dp"
                android:background="@drawable/border"
                android:padding="5dp"
                android:text="Error"
                android:textAlignment="center"
                android:textStyle="bold"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:textSize="15dp">

            </TextView>

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="5dp">

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/border"
                android:padding="5dp"
                android:text="0"
                android:textAlignment="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black">

            </TextView>

            <EditText
                android:id="@+id/editText2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/border"
                android:padding="5dp"
                android:textAlignment="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black">

            </EditText>

            <TextView
                android:id="@+id/error2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="5dp"
                android:background="@drawable/border"
                android:text="0"
                android:textAlignment="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black">

            </TextView>
        </TableRow>


    </TableLayout>
</ScrollView>

The first text view should update automatically by an interval of 20 (0, 20, 40, 60, .....) and edit text will be edited manually and 2nd text view should calculate automatically (first text view - edit text)


Can anyone guide me on how to do this program?
 

Attachments

  • 123.jpg
    123.jpg
    77.9 KB · Views: 118

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones