Java 使用自定义适配器将ContentValue加载到ListView中

Java 使用自定义适配器将ContentValue加载到ListView中,java,android,listview,hashmap,Java,Android,Listview,Hashmap,我正在尝试使用如下所示的自定义适配器将ContentValues加载到ListView中 public class LazyAdapter extends BaseAdapter { private Activity activity; private ContentValues values = new ContentValues(); private static LayoutInflater inflater = null; public LazyAdapter(Acti

我正在尝试使用如下所示的自定义适配器将
ContentValues
加载到
ListView

public class LazyAdapter extends BaseAdapter {
  private Activity activity;
  private ContentValues values = new ContentValues();
  private static LayoutInflater inflater = null;

  public LazyAdapter(Activity a, ContentValues v) {
    activity = a;
    values = v;
    inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;
    if(convertView == null)
        vi = inflater.inflate(R.layout.list_item, null);

    TextView name = (TextView) vi.findViewById(R.id.list_item_text_name);
    TextView reg_no. = (TextView) vi.findViewById(R.id.list_item_text_reg_no);
    ImageView image_thumb = (ImageView) vi.findViewById(R.id._list_item_image);
    ContentValues student = new ContentValues();

    /** here I am trying to get a single student data from the ContentValues **/
    student = values.get(position); //Getting the error on this line 

   //Setting values into the ListView
    name.setText(variant.getAsString(StudenttContract.Column.NAME));
    reg_no.setText(variant.getAsString(StudentContract.Column.REG_NO));
    imageLoader.DisplayImage(variant.getAsString(StudentContract.Column.thumb_url), image_thumb);
    return vi;
}
问题是我得到了一个错误:
ContentValues类型中的get(String)方法不适用于此行的参数(int)

    student = values.get(position);

我如何解决这个问题,或者如何从
ContentValues

中获取一名学生的数据,您可以包括ContentValues吗class@erik
ContentValues
类是从
android.content.ContentValues
导入的。那么,get只在那里获取一个字符串。。我想您应该创建一个学生数据模型类,而不是ContentValues,创建一个ArrayList@erik非常感谢一个
ArrayList
解决了我的问题。