Passing Multiple Lists into ArrayAdapter

后端 未结 4 1856
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 00:59

I start of with this in Activity:

adapter = new ItemAdapter(Items.this, items, totals);
        setListAdapter(adapter);

Now here is ItemAd

4条回答
  •  Happy的楠姐
    2021-01-17 01:59

    Why don't you just join both lists?

    List list1 = new ArrayList();
    a.add("Item 1");
    a.add("Item 2");
    
    List list2 = new ArrayList();
    b.add("Item 3");
    b.add("Item 4");
    
    // Append content of list2 to list1
    list1.addAll(list2);
    

    Then you can create your adapter as usual, with a single List.

提交回复
热议问题