I have an android application that, in a loop from a json line, takes the necessary data and stuffs it into a variable. After that, you need to fill the ListView array of these variables. I fill the array in the same loop, and after it is completed, I create an adapter and assign it to my ListView . But nothing comes out ... Here is the code:
JSONArray jsonarray = new JSONArray(jj); String[] val = new String[20]; //Π½Π΅ΠΎΠ±Ρ
ΠΎΠ΄ΠΈΠΌΡΠΉ ΠΌΠ½Π΅ ΠΌΠ°ΡΡΠΈΠ² int i; //Π‘Π°ΠΌ ΡΠΈΠΊΠ»: for (i = 0; i < jsonarray.length(); i++) { JSONObject obj = jsonarray.getJSONObject(i); String lesson = obj.getString("lesson"); String task = obj.getString("task"); //ΠΠΎΡ ΠΌΠΎΡ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ "data" String data = lesson + ": " + task; //ΠΠΎΡΠΎΡΡΡ Ρ Π·Π°ΠΏΠΈΡ
ΠΈΠ²Π°Ρ Π² ΠΌΠ°ΡΡΠΈΠ² Π² ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΠΈ Ρ ΠΏΠΎΡΡΠ΄ΠΊΠΎΠΌ (ΡΡΠ΅ΡΡΠΈΠΊ i) val[i] = data; } //Π Π΄Π°Π»ΡΡΠ΅ Π΄Π΅Π»Π°Π΅ΠΌ Π°Π΄Π°ΠΏΡΠ΅Ρ ΠΈ Π² listView Π΅Π³ΠΎ: ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mass); lv.setAdapter(adapter); //lv - listView ListView initialized, checked - everything is fine ... Help please who than can ..
valand in lv you passmass- ArchDemonthis? - post_zeew