Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. <ScrollView
  2. android:id="@+id/horizontalView"
  3. android:layout_width="fill_parent"
  4. android:layout_height="wrap_content"
  5. android:layout_below="@+id/Grid_layout" >
  6.  
  7. <TableLayout
  8. android:id="@+id/header"
  9. android:layout_width="match_parent"
  10. android:layout_height="wrap_content"
  11. android:layout_marginLeft="1dp"
  12. android:layout_marginRight="1dp"
  13. android:background="@android:color/black" >
  14.  
  15. <TableRow>
  16.  
  17. <TextView
  18. android:layout_margin="1dp"
  19. android:layout_weight="2"
  20. android:background="@android:color/white"
  21. android:gravity="center_horizontal"
  22. android:text="Item Name"
  23. android:textColor="@android:color/black"
  24. android:textSize="10sp" />
  25.  
  26. <TextView
  27. android:layout_margin="1dp"
  28. android:layout_weight="2"
  29. android:background="@android:color/white"
  30. android:gravity="center_horizontal"
  31. android:text="Rack"
  32. android:textColor="@android:color/black"
  33. android:textSize="10sp" />
  34.  
  35. <TextView
  36. android:layout_margin="1dp"
  37. android:layout_weight="2"
  38. android:background="@android:color/white"
  39. android:gravity="center_horizontal"
  40. android:text="Sale Rate"
  41. android:textColor="@android:color/black"
  42. android:textSize="10sp" />
  43.  
  44. <TextView
  45. android:layout_margin="1dp"
  46. android:layout_weight="2"
  47. android:background="@android:color/white"
  48. android:gravity="center_horizontal"
  49. android:text="Sys. Stock"
  50. android:textColor="@android:color/black"
  51. android:textSize="10sp"
  52. android:visibility="gone" />
  53.  
  54. <EditText
  55. android:layout_margin="1dp"
  56. android:layout_weight="2"
  57. android:background="@android:color/white"
  58. android:gravity="center_horizontal"
  59. android:text="Phy. Stock"
  60. android:textColor="@android:color/black"
  61. android:textSize="10sp" />
  62. </TableRow>
  63. </TableLayout>
  64. </ScrollView>
  65.  
  66. JAVA Code:
  67.  
  68. public void writeJSON() {
  69.  
  70. try {
  71. ArrayList<EditText> metl = new ArrayList<EditText>();
  72.  
  73. for (int i = 1; i < tableLayout.getChildCount(); i++) {
  74. TableRow mRow = (TableRow) tableLayout.getChildAt(i);
  75.  
  76. TextView firstTextView = (TextView) mRow.getChildAt(3);
  77. String firstText = firstTextView.getText().toString();
  78.  
  79. if (mRow.getChildAt(4) instanceof EditText) {
  80. EditText secondTextView = (EditText) mRow.getChildAt(4);
  81. String secondText = secondTextView.getText().toString();
  82.  
  83. }
  84. }
  85. } catch (ClassCastException se) {
  86. Log.e(getClass().getSimpleName(),
  87. "Could not create or Open the database");
  88. }
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement