开发者

How to bind two array lists to listview in android?

My code is like this

I want to display Title,resumen,condition in one single row of listview

can u please help me.

Titles=new ArrayList<String>();
Resumens=new ArrayList<String>();
Conditions=new ArrayList<String>();

for(int i=0;i<resp2.getPropertyCount();i++)
{                          
    SoapObject table = (SoapO开发者_开发知识库bject)resp2.getProperty(i);
    Titles.add(table.getProperty("Titulo").toString());
    Resumens.add(table.getProperty("Resumen").toString());
    Conditions.add(table.getProperty("Condiciones").toString());
}


Are you want some like this ?

class Triplet {
    public String title;
    public String resume;
    public String condition;

    public Triplet(String title, String resume, String condition) {
        this.title = title;
        this.resume = resume;
        this.condition = condition;
    }
}

....


ArrayList<Triplet> list=new ArrayList<Triplet>();

for(int i=0;i<resp2.getPropertyCount();i++)
{
    SoapObject table = (SoapObject)resp2.getProperty(i);
    Triplet triplet = new Triplet(table.getProperty("Titulo").toString(),
                                  table.getProperty("Resumen").toString(),
                                  table.getProperty("Condiciones").toString());
    list.add(triplet);
}


You need to override the getView method in adapter class,by using the getView method you will get the position of the list position,pass that position to your array lists to get the corresponding values.But it all depends your adapter and how you inflate the layout.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜