Create an adapter for your listview, much like sandy suggested, then call the adapter in your activity. Here's an example of one of my adapters:
public class DictionaryListAdapter extends BaseAdapter {
private static ArrayList<Term> termsList;
private LayoutInflater mInflater;
public DictionaryListAdapter (Context ctx, ArrayList<Term> results){
termsList = results;
mInflater = LayoutInflater.from(ctx);
}
public int getCount() {
// TODO Auto-generated method stub
return termsList.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return termsList.get(position);
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder;
if (convertView == null){
convertView = mInflater.inflate(R.layout.dictionarylistinflater, null);
holder = new ViewHolder();
holder.tvTerm = (TextView) convertView.findViewById(R.id.tvTerm);
holder.tvAbbr = (TextView) convertView.findViewById(R.id.tvAbbreviation);
convertView.setTag(holder);
}
else{
holder = (ViewHolder) convertView.getTag();
}
holder.tvTerm.setText(termsList.get(position).getWord());
holder.tvAbbr.setText(termsList.get(position).getAbbr1() + " " +termsList.get(position).getAbbr2());
return convertView;
}
static class ViewHolder{
TextView tvTerm;
TextView tvAbbr;
}
}
And here's how I called it in the activity:
//set the listview
final ListView lvTerms = getListView();
lvTerms.setAdapter(new DictionaryListAdapter(this, terms));
lvTerms.setTextFilterEnabled(true);
I would also take Stefan's advice and combine it into one array. "terms" for me is an array list of terms, and each term has a full name, two abbreviations, a definition, and a formula. Good luck!