-1

当我使用 SimpleCursorAdapter 的构造函数时,它告诉我构造函数未定义。

我应该怎么办?

public class ReminderListFragment extends ListFragment implements LoaderCallbacks<Cursor> {
private SimpleCursorAdapter mAdapter;

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    String[] from = new String[] {ReminderProvider.COLUMN_TITLE};
    int[] to = new int[] {R.id.text1};
    mAdapter = new SimpleCursorAdapter(getActivity(), R.layout.reminder_row, null, from, 2, 0);
    setListAdapter(mAdapter);
    getLoaderManager().initLoader(0, null, this);
}
4

1 回答 1

3

将这一行改为这一行:

mAdapter = new SimpleCursorAdapter(getActivity(), 
                    R.layout.reminder_row, null, from, to, 0);

你有一个“2”而不是“to”

SimpleCursorAdapter 的构造函数:

SimpleCursorAdapter(Context context, int layout, Cursor c, 
                                String[] from, int[] to, int flags)

来自:http: //developer.android.com/reference/android/widget/SimpleCursorAdapter.html

于 2013-04-08T20:03:32.837 回答