I would like to be able to display two lines of text per row in my listview.

Under each of those titles, I would like to display another line of text for the date and author name.
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
titleArray = new ArrayList<String>();
titleArrayAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
R.id.itemName, titleArray);
}
public void getThreads() throws IOException {
Thread getThreadsThread = new Thread() {
public void run() {
Document doc = null;
try {
doc = Jsoup.connect(Constants.FORUM).get();
} catch (IOException e) {
e.printStackTrace();
}
Elements threads = doc.select(".topic_title");
for (Element thread : threads) {
threadTitle = thread.text();
titleArray.add(threadTitle);
}
}
};
getThreadsThread.start();
try {
getThreadsThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
mHandler.sendEmptyMessage(0);
}
final Handler mHandler = new Handler(){
public void handleMessage (Message msg) {
switch (msg.what) {
case 0:
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setListAdapter(titleArrayAdapter);
}
});
break;
}
}
};
How would you recommend I add another line to the row? For now I would just like to add “Author” and “Date” to the second line, I just need a place holder until I have the code to parse out the corresponding fields.
Add a second
TextViewtores/layout/list_item.xml, sized and positioned wherever you want it.In addition, you will need to subclass
ArrayAdapterand overridegetView().ArrayAdapteronly knows how to handle oneTextViewper row — if you want more than that, you need to handle the rest yourself.