Guest User

Untitled

a guest
May 27th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. Trouble to fill listview correctly
  2. .. edit2Text
  3. .. edit2Text
  4. .. edit2Text
  5. € 0,00 edit2Text
  6. € 0,00 edit2Text
  7.  
  8. <?xml version="1.0" encoding="utf-8"?>
  9. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  10. android:layout_width="fill_parent"
  11. android:layout_height="fill_parent"
  12. android:orientation="horizontal">
  13.  
  14. <EditText
  15. android:inputType="textMultiLine"
  16. android:id="@+id/editText1"
  17. android:layout_height="wrap_content"
  18. android:text="edit1"
  19. android:layout_width="200dp"
  20. />
  21.  
  22. <EditText
  23. android:layout_height="wrap_content"
  24. android:layout_width="110dp"
  25. android:id="@+id/editText2"
  26. android:text="edit2"
  27. android:inputType="textMultiLine"
  28. android:layout_marginLeft="10dp"
  29. />
  30.  
  31. </LinearLayout>
  32.  
  33. Einddatum contract: 08-10-2012
  34. Prijs per maand: € 38,50 /mnd
  35. ...
  36.  
  37. 10-22 10:35:21.698: I/System.out(8132): Hashmap: {col_1=Einddatum contract:}
  38. 10-22 10:35:21.698: I/System.out(8132): Hashmap: {col_1=Prijs per maand:}
  39. 10-22 10:35:21.698: I/System.out(8132): Hashmap: {col_1=Einddatum contract:}
  40. 10-22 10:35:21.698: I/System.out(8132): Hashmap: {col_1=Prijs per maand:}
  41. 10-22 10:35:21.698: I/System.out(8132): Hashmap: {col_1=Nieuw beltegoed:}
  42. 10-22 10:35:21.698: I/System.out(8132): Hashmap: {col_1=Tegoed vorige periode:}
  43. 10-22 10:35:21.708: I/System.out(8132): Hashmap: {col_1=Tegoed tot 09-11-2011:}
  44. 10-22 10:35:21.708: I/System.out(8132): Hashmap: {col_1=}
  45. 10-22 10:35:21.708: I/System.out(8132): Hashmap: {col_1=Verbruik sinds nieuw tegoed:}
  46. 10-22 10:35:21.708: I/System.out(8132): Hashmap: {col_1=Ongebruikt tegoed:}
  47. 10-22 10:35:21.708: I/System.out(8132): Hashmap: {col_1=Verbruik boven bundel:}
  48. 10-22 10:35:21.708: I/System.out(8132): Hashmap: {col_1=Verbruik dat niet in de bundel zit*:}
  49. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=08-10-2012}
  50. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 38,50 /mnd}
  51. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=08-10-2012}
  52. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 38,50 /mnd}
  53. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 54,64}
  54. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 17,28}
  55. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 71,92}
  56. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=}
  57. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 5,32}
  58. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 66,60}
  59. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 0,00}
  60. 10-22 10:35:21.718: I/System.out(8132): Hashmap1: {col_2=€ 0,00}
  61.  
  62. @Override
  63. protected void onPostExecute(String result) {
  64. // create the grid item mapping
  65. ListView kp = (ListView)findViewById(R.id.kpn);
  66.  
  67. String[] from = new String[] {"col_1", "col_2"};
  68. int[] to = new int[] { R.id.editText1, R.id.editText1 };
  69.  
  70. List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
  71. HashMap<String, String> map = new HashMap<String, String>();
  72. HashMap<String, String> map1 = new HashMap<String, String>();
  73.  
  74.  
  75. Document doc = Jsoup.parse(kpn);
  76. Elements tdsFromSecondColumn = doc.select("table.personaltable td:eq(0)");
  77. Elements tdsFromSecondColumn1 = doc.select("table.personaltable td:eq(1)");
  78.  
  79. for (Element tdFromSecondColumn : tdsFromSecondColumn) {
  80. map.put("col_1", tdFromSecondColumn.text());
  81. fillMaps.add(map);
  82.  
  83. System.out.println("Hashmap: " + map);
  84.  
  85. }
  86. for (Element tdFromSecondColumn1 : tdsFromSecondColumn1) {
  87. map1.put("col_2", tdFromSecondColumn1.text());
  88. fillMaps.add(map1);
  89.  
  90. System.out.println("Hashmap1: " + map1);
  91. }
  92.  
  93. SimpleAdapter adapter = new SimpleAdapter(AndroidLogin.this, fillMaps, R.layout.test, from, to);
  94. kp.setAdapter(adapter);
  95.  
  96. @Override
  97. protected void onPostExecute(String result) {
  98. // create the grid item mapping
  99. ListView kp = (ListView)findViewById(R.id.kpn);
  100.  
  101. String[] from = new String[] {"col_1", "col_2"};
  102. int[] to = new int[] { R.id.editText1, R.id.editText2 };
  103.  
  104. List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
  105. List<HashMap<String, String>> fillMaps1 = new ArrayList<HashMap<String, String>>();
  106. List<HashMap<String, String>> fill_Maps = new ArrayList<HashMap<String, String>>();
  107.  
  108. HashMap<String, String> map;
  109. HashMap<String, String> map1;
  110.  
  111.  
  112. Document doc = Jsoup.parse(kpn);
  113. Elements tdsFromSecondColumn = doc.select("table.personaltable td:eq(0)");
  114. Elements tdsFromSecondColumn1 = doc.select("table.personaltable td:eq(1)");
  115.  
  116. for (Element tdFromSecondColumn : tdsFromSecondColumn) {
  117.  
  118. map = new HashMap<String, String>();
  119. map.put("col_1", tdFromSecondColumn.text());
  120. fillMaps.add(map);
  121.  
  122. System.out.println("Hashmap: " + map);
  123.  
  124. }
  125. for (Element tdFromSecondColumn1 : tdsFromSecondColumn1) {
  126. map1 = new HashMap<String, String>(); map1.put("col_2", tdFromSecondColumn1.text());
  127. fillMaps1.add(map1);
  128.  
  129. System.out.println("Hashmap1: " + map1);
  130. }
  131.  
  132. for (int i=0;i<fillMap.size();i++) {
  133.  
  134. fill_Map.add(fillMap.get(i));
  135. fill_Map.add(fillMap1.get(i));
  136. }
  137. SimpleAdapter adapter = new SimpleAdapter(AndroidLogin.this, fill_Map, R.layout.test, from, to);
  138. kp.setAdapter(adapter);
Advertisement
Add Comment
Please, Sign In to add comment