首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >getLoaderManager().initLoader()不接受'this‘作为参数,尽管类(ListFragment)实现了LoaderManager.LoaderCallbacks<Cursor>

getLoaderManager().initLoader()不接受'this‘作为参数,尽管类(ListFragment)实现了LoaderManager.LoaderCallbacks<Cursor>
EN

Stack Overflow用户
提问于 2012-06-22 20:00:35
回答 13查看 52.1K关注 0票数 65

在安卓系统中使用SQLite时,我在guide上遇到了问题。我使用的是ListFragment而不是ListActivity(如示例所示),因此我让ListFragment实现LoaderManager.LoaderCallbacks<Cursor>。然后,在ListFragment中的fillData()方法中

代码语言:javascript
复制
private void fillData() {
    // Fields from the database (projection)
    // Must include the _id column for the adapter to work
    String[] from = new String[] { NotesSQLiteHelper.COLUMN_TITLE };
    // Fields on the UI to which we map
    int[] to = new int[] { R.id.label };

    getLoaderManager().initLoader(0, null, this); //error
    adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.notes_row, null, from, to, 0);
    setListAdapter(adapter);
}

我得到了错误:

代码语言:javascript
复制
The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks<D>) in the type LoaderManager is not applicable for the arguments (int, null, NotesActivity.ArrayListFragment)

在标记的行上,即使this实现了LoaderManager.LoaderCallbacks<Cursor>

谢谢你的任何想法。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11155753

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档