Note that there are some explanatory texts on larger screens.

plurals
  1. POset ImageView src via ListAdapter
    primarykey
    data
    text
    <p>Hey there, i have one question..</p> <p>i try to write an android app with java.</p> <p>i have a hashmaplist(1), saved in a list(2). to show the list(2) entrys(those, who saved in hashmap(1)), i use a ListAdapter object.</p> <p>everything works fine, except of the following: one of the entrys, saved in the hashmaplist(1), is "country", like 'at', 'de', 'gb', ... now i want to change a pics' source, that was created on the layout, depends on the country entry.</p> <p>here some code..</p> <p>save entrys and show it with a ListAdapter object:</p> <pre><code>for (int i = 0; i &lt; itemArray.length(); ++i) { JSONObject rec = itemArray.getJSONObject(i); //save entrys in hashmap map = new HashMap&lt;String, String&gt;(); map.put("name", rec.getString("name")); map.put("country", rec.getString("country")); //save hashmap entry in list mylist.add(map); } ListAdapter mSchedule = new SimpleAdapter(this, mylist, R.layout.listitem, new String[] {"name"}, new int[] {R.id.area}); listview.setAdapter(mSchedule); </code></pre> <p>Now the Layout XML:</p> <pre><code>&lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;ImageView android:id="@+id/imageView10" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/be"&gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/area" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; </code></pre> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload