Gali
Gali

Reputation: 14953

Inserting two arrays into ListView in Android

I have two arrays

arr1:
1 2 3 4 5 6

arr2:
a b c d e f

I have custom ListView that has TextView1 and TextView2

How to bind the two arrays into the custom ListView?

TextView1  |  TextView2
-----------------------
     1     |      a
     2     |      b
     3     |      c
     4     |      d
     5     |      e
     6     |      f

Upvotes: 0

Views: 1602

Answers (1)

user370305
user370305

Reputation: 109237

Instead of two string arrays use Custom Object Array which contains two strings. And make a custom adapter and set it to your listview. Also make a Listitem with two textview for like two column listview. And set values in your custom adapter's getView().

Look at this tutorial Android – Multi Column ListView

Android – Multi Column ListView

Upvotes: 4

Related Questions