Depending on what I interpreted your problem correctly, this should be possible with an adapter:
You can extend BaseAdaptor by overriding getView () and return some ViewGroup containing widgets representing data from different lists.
Subclassing the ViewGroup to create a complex view that is easier to process:
public class DoubleText extends LinearLayout { TextView t1, t2; public DoubleText(Context c) { super(c); t1 = new TextView(c); t2 = new TextView(c); this.addView(t1, 0); this.addView(t2, 1); } public void setText(String s1, String s2) { t1.setText(s1); t2.setText(s2); } }
The subclassification of the BaseAdapter, however, not all the necessary data is shown, there is more, but it should be easier to find out, as this is where there are big differences compared to other examples regarding the use of adapters:
public class DoubleAdaptor extends BaseAdaptor { List<String> lista, listb;
In addition, you do not have to have the same view type for all rows, i.e. override getViewTypeCount () to give the android an upper limit on the number of different kinds of types to use and getItemViewType (int position) to tell android what kind of view to iterate over for that particular row.
Edit: I would recommend checking the Android developer docs on the Adapter (Interface) and BaseAdapter (abstract class) and ListAdapter (interface) interface, also I forgot to tell you that ListView has setAdapter (), which may be of interest.
source share