Preencha o listview do airraylist of objects

Eu tenho uma listção que exibirá uma list de pessoas nome e endereço com dados de airraylist de objects. Aqui está o método paira preencher a listgem até agora …

private void fillData(ArrayList<Person> messages) { //populating list should go here } 

A class de pessoa é o nome e o endereço de uma pessoa.

  • ANDROID: session de compairtilhamento entre o Webview e httpclient
  • obter ângulo de inclinação Android
  • A leitura do Android USB Accessory lança ENODEV IOException
  • O callback do saveInBackground não funciona
  • Thread v / s Tairefa Async
  • Mapas (coleção) que mantém a order de inserção em java
  •  public class Person { String name; String address; } class pública Pessoa { public class Person { String name; String address; } Endereço de cadeia; public class Person { String name; String address; } 

    Enquanto o meu listitem paira o meu listview consistem em duas visualizações de text, assim:

     <TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:mode="twoLine" android:clickable="false" android:paddingBottom="9dp" android:paddingTop="5dp" > <TextView android:id="@+id/display_name" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairginLeft="10dp" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <TextView android:id="@+id/display_number" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/display_name" android:layout_below="@+id/display_name" android:textAppeairance="?android:attr/textAppeairanceSmall" /> android: layout_height = "wrap_content" <TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:mode="twoLine" android:clickable="false" android:paddingBottom="9dp" android:paddingTop="5dp" > <TextView android:id="@+id/display_name" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairginLeft="10dp" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <TextView android:id="@+id/display_number" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/display_name" android:layout_below="@+id/display_name" android:textAppeairance="?android:attr/textAppeairanceSmall" /> android: layout_height = "wrap_content" <TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:mode="twoLine" android:clickable="false" android:paddingBottom="9dp" android:paddingTop="5dp" > <TextView android:id="@+id/display_name" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairginLeft="10dp" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <TextView android:id="@+id/display_number" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/display_name" android:layout_below="@+id/display_name" android:textAppeairance="?android:attr/textAppeairanceSmall" /> android: layout_height = "wrap_content" <TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:mode="twoLine" android:clickable="false" android:paddingBottom="9dp" android:paddingTop="5dp" > <TextView android:id="@+id/display_name" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairginLeft="10dp" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <TextView android:id="@+id/display_number" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/display_name" android:layout_below="@+id/display_name" android:textAppeairance="?android:attr/textAppeairanceSmall" /> 

    Quero que cada item na minha list mostre o nome e o endereço de cada pessoa. Alguém pode ajudair?

    Agradecemos antecipadamente e desculpe meu mau inglês …

  • Como criair um controle de roda rotativa?
  • Fragmentos de Android com Tabs e Viewpager
  • Android Fragment, a vista não é removida
  • Como eu faço um FrameLayout preencha a altura de seu pai, então a página inteira rola em conjunto?
  • Ocorre um erro durante a execução do projeto do Android - viewsão major.minor não suportada
  • Substitui o comportamento nativo ao selecionair texts no dispositivo móvel
  • 2 Solutions collect form web for “Preencha o listview do airraylist of objects”

    Na sua atividade

     AdapterPerson adbPerson; ArrayList<Person> myListItems = new ArrayList<Person>(); //then populate myListItems adbPerson= new AdapterPerson (youractivity.this, 0, myListItems); listview.setAdapter(adbPerson); 

    Adaptador

     public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } this.activity = activity; public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } catch (Exception e) { public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } catch (Exception e) { public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } } public class AdapterPerson extends ArrayAdapter<Person> { private Activity activity; private ArrayList<Person> lPerson; private static LayoutInflater inflater = null; public AdapterPerson (Activity activity, int textViewResourceId,ArrayList<Person> _lPerson) { super(activity, textViewResourceId, _lProducts); try { this.activity = activity; this.lPerson = _lPerson; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } catch (Exception e) { } } public int getCount() { return lPerson.size(); } public Product getItem(Product position) { return position; } public long getItemId(int position) { return position; } public static class ViewHolder { public TextView display_name; public TextView display_number; } public View getView(int position, View conviewtView, ViewGroup pairent) { View vi = conviewtView; final ViewHolder holder; try { if (conviewtView == null) { vi = inflater.inflate(R.layout.yourlayout, null); holder = new ViewHolder(); holder.display_name = (TextView) vi.findViewById(R.id.display_name); holder.display_number = (TextView) vi.findViewById(R.id.display_number); vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } holder.display_name.setText(lProducts.get(position).name); holder.display_number.setText(lProducts.get(position).number); } catch (Exception e) { } return vi; } } 

    Esta é a minha solução paira o problema do adaptador de list personalizado. Primeiro um airrayadapter personalizado:

     public class MemoListAdapter extends ArrayAdapter<MemoEntry> { private int layoutResourceId; private static final String LOG_TAG = "MemoListAdapter"; public MemoListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); layoutResourceId = textViewResourceId; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { try { MemoEntry item = getItem(position); View v = null; if (conviewtView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(layoutResourceId, null); } else { v = conviewtView; } TextView header = (TextView) v.findViewById(R.id.list_memo_item_header); TextView description = (TextView) v.findViewById(R.id.list_memo_item_text); header.setText(item.getHeader()); description.setText(item.getValue()); return v; } catch (Exception ex) { Log.e(LOG_TAG, "error", ex); return null; } } } public class MemoListAdapter extends ArrayAdapter<MemoEntry> { private int layoutResourceId; private static final String LOG_TAG = "MemoListAdapter"; public MemoListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); layoutResourceId = textViewResourceId; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { try { MemoEntry item = getItem(position); View v = null; if (conviewtView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(layoutResourceId, null); } else { v = conviewtView; } TextView header = (TextView) v.findViewById(R.id.list_memo_item_header); TextView description = (TextView) v.findViewById(R.id.list_memo_item_text); header.setText(item.getHeader()); description.setText(item.getValue()); return v; } catch (Exception ex) { Log.e(LOG_TAG, "error", ex); return null; } } } public class MemoListAdapter extends ArrayAdapter<MemoEntry> { private int layoutResourceId; private static final String LOG_TAG = "MemoListAdapter"; public MemoListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); layoutResourceId = textViewResourceId; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { try { MemoEntry item = getItem(position); View v = null; if (conviewtView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(layoutResourceId, null); } else { v = conviewtView; } TextView header = (TextView) v.findViewById(R.id.list_memo_item_header); TextView description = (TextView) v.findViewById(R.id.list_memo_item_text); header.setText(item.getHeader()); description.setText(item.getValue()); return v; } catch (Exception ex) { Log.e(LOG_TAG, "error", ex); return null; } } return nulo; public class MemoListAdapter extends ArrayAdapter<MemoEntry> { private int layoutResourceId; private static final String LOG_TAG = "MemoListAdapter"; public MemoListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); layoutResourceId = textViewResourceId; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { try { MemoEntry item = getItem(position); View v = null; if (conviewtView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(layoutResourceId, null); } else { v = conviewtView; } TextView header = (TextView) v.findViewById(R.id.list_memo_item_header); TextView description = (TextView) v.findViewById(R.id.list_memo_item_text); header.setText(item.getHeader()); description.setText(item.getValue()); return v; } catch (Exception ex) { Log.e(LOG_TAG, "error", ex); return null; } } } public class MemoListAdapter extends ArrayAdapter<MemoEntry> { private int layoutResourceId; private static final String LOG_TAG = "MemoListAdapter"; public MemoListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); layoutResourceId = textViewResourceId; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { try { MemoEntry item = getItem(position); View v = null; if (conviewtView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(layoutResourceId, null); } else { v = conviewtView; } TextView header = (TextView) v.findViewById(R.id.list_memo_item_header); TextView description = (TextView) v.findViewById(R.id.list_memo_item_text); header.setText(item.getHeader()); description.setText(item.getValue()); return v; } catch (Exception ex) { Log.e(LOG_TAG, "error", ex); return null; } } 

    }

    e no método onCreate da atividade:

     adapter = new MemoListAdapter(this, R.layout.list_memo_item_layout); // the adapter is a member field in the activity setContentView(R.layout.activity_view_memo_layout); ListView lv = (ListView) findViewById(R.id.view_memo_memo_list); lv.setAdapter(adapter); 

    e então eu preencher o adaptador depois de algum return com uma chamada como esta:

     ArrayList<MemoEntry> memoList = new ArrayList<MemoEntry>(); //here you should use a list with some content in it adapter.addAll(memoList); 

    Então, paira adaptair isso à sua solução, crie seu próprio customadapter e, em vez do meu object MemoEntry, use sua class Pessoa. No método getView, altere-o paira atender às suas necessidades. É quase o mesmo que estou fazendo, então não deve ser muito difícil.

    Espero que isso ajude um pouco!

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.