Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use custom Adapter
    text
    copied!<p>I KNOW this is a repost, but I've been trying to get this to work for ages (hours) now and I really can't understand the existing answers. All i want to know is: How can I edit this code so it works? I'm trying to populate both textviews from two different arrays.</p> <p>Only the second adapter gets read and the first one's textview stays blank.</p> <p>Any help at all would be appreciated.</p> <pre><code> public void run () { if (t.getState() == Thread.State.TERMINATED) { adapter2 = new ArrayAdapter&lt;String&gt;(getApplicationContext(), R.layout.listlook, R.id.txtl2, names); setListAdapter(adapter2); adapter = new ArrayAdapter&lt;String&gt;(getApplicationContext(), R.layout.listlook, R.id.txtl1, comments); setListAdapter(adapter); return; } else { h.postDelayed(this, 1000); } }} , 1000); } </code></pre> <p>Thanks in advance.</p> <p>Listview within Usercomments.xml</p> <pre><code> &lt;ListView android:id="@+android:id/list" android:layout_width="match_parent" android:layout_height="150dp" &gt; &lt;/ListView&gt; </code></pre> <p>listlook.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/txtl1" android:paddingLeft="2dp" android:textSize="20sp" android:textStyle="bold" android:textColor="#0000FF" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TextView" /&gt; &lt;TextView android:id="@+id/txtl2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/txtl1" android:gravity="bottom|right" android:paddingLeft="5dp" android:text="TextView" android:textColor="#5C002E" android:textSize="15sp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>listlook is just the layout i use in the listview? Don't really know what I'm doing.</p>
 

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