Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ScrollView
- android:id="@+id/horizontalView"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/Grid_layout" >
- <TableLayout
- android:id="@+id/header"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginLeft="1dp"
- android:layout_marginRight="1dp"
- android:background="@android:color/black" >
- <TableRow>
- <TextView
- android:layout_margin="1dp"
- android:layout_weight="2"
- android:background="@android:color/white"
- android:gravity="center_horizontal"
- android:text="Item Name"
- android:textColor="@android:color/black"
- android:textSize="10sp" />
- <TextView
- android:layout_margin="1dp"
- android:layout_weight="2"
- android:background="@android:color/white"
- android:gravity="center_horizontal"
- android:text="Rack"
- android:textColor="@android:color/black"
- android:textSize="10sp" />
- <TextView
- android:layout_margin="1dp"
- android:layout_weight="2"
- android:background="@android:color/white"
- android:gravity="center_horizontal"
- android:text="Sale Rate"
- android:textColor="@android:color/black"
- android:textSize="10sp" />
- <TextView
- android:layout_margin="1dp"
- android:layout_weight="2"
- android:background="@android:color/white"
- android:gravity="center_horizontal"
- android:text="Sys. Stock"
- android:textColor="@android:color/black"
- android:textSize="10sp"
- android:visibility="gone" />
- <EditText
- android:layout_margin="1dp"
- android:layout_weight="2"
- android:background="@android:color/white"
- android:gravity="center_horizontal"
- android:text="Phy. Stock"
- android:textColor="@android:color/black"
- android:textSize="10sp" />
- </TableRow>
- </TableLayout>
- </ScrollView>
- JAVA Code:
- public void writeJSON() {
- try {
- ArrayList<EditText> metl = new ArrayList<EditText>();
- for (int i = 1; i < tableLayout.getChildCount(); i++) {
- TableRow mRow = (TableRow) tableLayout.getChildAt(i);
- TextView firstTextView = (TextView) mRow.getChildAt(3);
- String firstText = firstTextView.getText().toString();
- if (mRow.getChildAt(4) instanceof EditText) {
- EditText secondTextView = (EditText) mRow.getChildAt(4);
- String secondText = secondTextView.getText().toString();
- }
- }
- } catch (ClassCastException se) {
- Log.e(getClass().getSimpleName(),
- "Could not create or Open the database");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement