1

I am following this example: http://developer.android.com/guide/topics/ui/layout/listview.html

I am at this method:

// Called when a new Loader needs to be created
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    // Now create and return a CursorLoader that will take care of
    // creating a Cursor for the data being displayed.
    return new CursorLoader(this, ContactsContract.Data.CONTENT_URI,
            PROJECTION, SELECTION, null, null);
}

I am trying to construct my own CursorLoader for a SQLite database. I have created earlier a subclass of SQLiteOpenHelper. How do I get a URI to be used as a second argument of CursorLoader constructor?

4

1 回答 1

1

如果你想使用 aCursorLoader从你自己的 SQLite 数据库中加载数据,那么你必须首先实现一个ContentProvider。那里有很多很好的教程,例如Wolfram Rittmeyer 博客中的编写自己的内容提供程序。

示例中的 URI 来自ContactsProvider

于 2013-10-30T23:44:40.020 回答