Android SimpleCursorAdapter到CustomCusorAdapter

Android SimpleCursorAdapter到CustomCusorAdapter,android,android-adapter,android-cursoradapter,Android,Android Adapter,Android Cursoradapter,我正试图将我为SimpleUserAdapter编写的这段代码转换为自定义代码,因为我希望能够执行更多的操作,只要SimpleUserAdapter能够提供,我对创建SimpleUserAdapter很好奇,转换会是什么样子,我的CustomAdapter中不断出现错误,但转换起来应该没有我想象的那么困难。让我知道你的想法。谢谢 代码: private void fillData() { // Fields from the database (projection) // M

我正试图将我为
SimpleUserAdapter
编写的这段代码转换为自定义代码,因为我希望能够执行更多的操作,只要
SimpleUserAdapter
能够提供,我对创建
SimpleUserAdapter
很好奇,转换会是什么样子,我的CustomAdapter中不断出现错误,但转换起来应该没有我想象的那么困难。让我知道你的想法。谢谢

代码:

private void fillData() {

    // Fields from the database (projection)
    // Must include the _id column for the adapter to work
    String[] from = new String[] { TestTodoTable.COLUMN_SUMMARY };
    // Fields on the UI to which we map
    int[] to = new int[] { R.id.label };

    // this.getLoaderManager().getLoader(0);
    this.getLoaderManager().initLoader(0, null, this);
    // _adapter = new TestCursorAdapter(this.getActivity()
    // .getApplicationContext(), _cursor, true);

    _adapter = new SimpleCursorAdapter(this.getActivity().getApplicationContext(), R.layout.test_pro_row, null, from, to, 0);

    setListAdapter(_adapter);
}
编辑:

private void fillData() {

    // Fields from the database (projection)
    // Must include the _id column for the adapter to work
    String[] from = new String[] { TestTodoTable.COLUMN_SUMMARY };
    // Fields on the UI to which we map
    int[] to = new int[] { R.id.label };

    // this.getLoaderManager().getLoader(0);
    this.getLoaderManager().initLoader(0, null, this);
    // _adapter = new TestCursorAdapter(this.getActivity()
    // .getApplicationContext(), _cursor, true);

    _adapter = new SimpleCursorAdapter(this.getActivity().getApplicationContext(), R.layout.test_pro_row, null, from, to, 0);

    setListAdapter(_adapter);
}
我正在尝试使用的自定义游标类

public class TestCursorAdapter extends CursorAdapter {

    static class ViewHolder {
        public ImageView imageView;
        public TextView textView;
    }

    public TestCursorAdapter(Context context, Cursor c, boolean autoRequery) {
        super(context, c, autoRequery);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rowView = inflater.inflate(R.layout.test_pro_row, null, true);

        ViewHolder holder = new ViewHolder();
        holder.textView = (TextView) rowView.findViewById(R.id.row_sum);
        holder.imageView = (ImageView) rowView.findViewById(R.id.icon);
        rowView.setTag(holder);

        return rowView;
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        ViewHolder holder = (ViewHolder) view.getTag();

        String s = cursor.getString(cursor
                .getColumnIndex(TestTodoTable.COLUMN_SUMMARY));
        holder.textView.setText(s);

        if (cursor.getString(cursor.getColumnIndex("category")) == "Urgent") {
            holder.imageView.setImageResource(R.drawable.action_add);
        } else {
            holder.imageView.setImageResource(R.drawable.action_refresh);
        }
    }
}
我得到的错误-->


这里有什么问题?您会遇到什么错误?实际上,为什么需要扩展SimpleCursorAdapter?不是扩展SimpleCursorAdapter,而是检查我的编辑以了解我试图使用的内容,正如你所看到的,被注释掉了。那么为什么你要扩展CursorAdapter而不是使用SimpleCursorAdapter呢?我想在它的基础上做更多的事情,而不仅仅是使用SimpleCursorAdapter,原因是无关紧要的,因为我正试图让我的东西发挥作用。。。。