任务:
从数据库中获得Person对象,通过继承BaseAdapter类,显示ListView,如下所示:
(此处我们数据库操作的代码略,因为主要讲解的是ListView)
PersonAdapter.java
package org.xiazdong.db.domain;
import java.util.List;
import org.xiazdong.db.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class PersonAdapter extends BaseAdapter {
private List<Person> persons; //数据
private int resource; //item的布局
private Context context;
private LayoutInflater inflator;
private TextView nameTextView;
private TextView ageTextView;
private TextView idTextView;
/**
*
* @param