我正在关注这个例子:http://developer.android.com/guide/topics/ui/layout/listview.html
我在这个方法:
// 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);
}
我正在尝试为 SQLite 数据库构建我自己的 CursorLoader。我之前创建了一个 SQLiteOpenHelper
的子类。如何获取 URI 用作 CursorLoader
构造函数的第二个参数?
最佳答案
如果您想使用CursorLoader
从您自己的SQLite 数据库中加载数据,那么您必须实现一个ContentProvider。第一的。那里有很多很好的教程,形式示例 Writing your own Content Provider来自 Wolfram Rittmeyer 的博客。
示例中的 URI 来自 ContactsProvider .
关于android - 在Android中为SQLite数据库构建LoaderManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19695385/