이 어댑터를 본 일반적인 목록을 하나 개의 목록에 모두 목록을 추가하고 설정하여 달성 될 수있다.
ArrayList<A> list1 = new ArrayList<A>();
ArrayList<Object> object = new ArrayList<Object>();
list1.add(new A());
object.add(new A());
ArrayList<B> list2 = new ArrayList<B>();
list2.add(new B());
object.add(new B());
object.add(new B());
listadapter mAdapterSeeLatest ;
mAdapterSeeLatest = new listadapter (getParent(),R.layout.help_row,object);
mCheckInListView.setAdapter(mAdapterSeeLatest);
private class listadapter extends ArrayAdapter {
ArrayList<Object> ListObject;
int srNumber = 1;
public listadapter (Context context, int textViewResourceId,
ArrayList<Object> objects) {
super(context, textViewResourceId, objects);
ListObject = objects;
}
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null)
{
LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row, null);
}
if(ListObject.get(position) instanceof A)
{
}
else if(ListObject.get(position) instanceof B)
{
}
}
//now set this object ArrayList() into the List.
그것은 나를 위해 일했습니다. 솔루션 megha 주셔서 감사합니다 ... – praveenb