I am trying to create a Listview with multiple strings.
Right now I have a function that it will do
while(i <= 10){
//GETS DATA FROM WEBPAGE ETC
a = DATAFROMWEBPAGE1;
b = DATAFROMWEBPAGE2;
c = DATAFROMWEBPAGE3
}
10 times with 10 different sections from the webpage and I wanted to put this in a list view with 3 textviews showing a, b, c. But I’m having a very hard time doing so.
You can write a custom ListAdapter to do this:
class AdapterItem:
class MyAdapter:
Layout:
The code is not complete, just to give you the idea:
-You create a new ListAdapter that handles your items
AdapaterItemin this example) inside your adapterListAdapterimplementation has to provide common methods likegetCount()andgetItem()getView(..)method you can return your custom view for each row. If you want to display 3 different text messages you have to define 3 Textviews in your layout and assign the strings ingetView(..)