本文整理了Java中android.database.Cursor.setNotificationUri()
方法的一些代码示例,展示了Cursor.setNotificationUri()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cursor.setNotificationUri()
方法的具体详情如下:
包路径:android.database.Cursor
类名称:Cursor
方法名:setNotificationUri
暂无
代码示例来源:origin: k9mail/k-9
@Override
public void setNotificationUri(ContentResolver cr, Uri uri) {
for (Cursor cursor : mCursors) {
cursor.setNotificationUri(cr, uri);
}
}
代码示例来源:origin: robolectric/robolectric
@Override @Implementation
public void setNotificationUri(ContentResolver contentResolver, Uri uri) {
wrappedCursor.setNotificationUri(contentResolver, uri);
}
代码示例来源:origin: facebook/stetho
@Override
public Cursor query(
Uri uri,
String[] projection,
String selection,
String[] selectionArgs,
String sortOrder) {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
Cursor cursor = db.query(
APODContract.TABLE_NAME,
projection,
selection,
selectionArgs,
null /* groupBy */,
null /* having */,
sortOrder,
null /* limit */);
cursor.setNotificationUri(getContext().getContentResolver(), APODContract.CONTENT_URI);
return cursor;
}
代码示例来源:origin: stackoverflow.com
final ForceLoadContentObserver observer;
public MyCursorLoader(final Context context, ...) {
super(context);
// ...
this.observer = new ForceLoadContentObserver();
}
@Override
public Cursor loadInBackground() {
SQLiteDatabase db = this.dbHelper.getReadableDatabase();
final Cursor c = queryDatabase(db);
if (c != null) {
// Ensure the cursor window is filled
c.getCount();
// this is to force a reload when the content change
c.registerContentObserver(this.observer);
// this make sure this loader will be notified when
// a notifyChange is called on the URI_MY_TABLE
c.setNotificationUri(getContext().getContentResolver(),
Constants.URI_MY_TABLE);
}
return c;
}
代码示例来源:origin: udacity/ud851-Exercises
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// Get access to underlying database (read-only for query)
final SQLiteDatabase db = mTaskDbHelper.getReadableDatabase();
// Write URI match code and set a variable to return a Cursor
int match = sUriMatcher.match(uri);
Cursor retCursor;
// Query for the tasks directory and write a default case
switch (match) {
// Query for the tasks directory
case TASKS:
retCursor = db.query(TABLE_NAME,
projection,
selection,
selectionArgs,
null,
null,
sortOrder);
break;
// Default exception
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
// Set a notification URI on the Cursor and return that Cursor
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
// Return the desired Cursor
return retCursor;
}
代码示例来源:origin: udacity/ud851-Exercises
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// Get access to underlying database (read-only for query)
final SQLiteDatabase db = mTaskDbHelper.getReadableDatabase();
// Write URI match code and set a variable to return a Cursor
int match = sUriMatcher.match(uri);
Cursor retCursor;
// Query for the tasks directory and write a default case
switch (match) {
// Query for the tasks directory
case TASKS:
retCursor = db.query(TABLE_NAME,
projection,
selection,
selectionArgs,
null,
null,
sortOrder);
break;
// Default exception
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
// Set a notification URI on the Cursor and return that Cursor
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
// Return the desired Cursor
return retCursor;
}
代码示例来源:origin: udacity/ud851-Exercises
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// COMPLETED (1) Get access to underlying database (read-only for query)
final SQLiteDatabase db = mTaskDbHelper.getReadableDatabase();
// COMPLETED (2) Write URI match code and set a variable to return a Cursor
int match = sUriMatcher.match(uri);
Cursor retCursor;
// COMPLETED (3) Query for the tasks directory and write a default case
switch (match) {
// Query for the tasks directory
case TASKS:
retCursor = db.query(TABLE_NAME,
projection,
selection,
selectionArgs,
null,
null,
sortOrder);
break;
// Default exception
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
// COMPLETED (4) Set a notification URI on the Cursor and return that Cursor
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
// Return the desired Cursor
return retCursor;
}
代码示例来源:origin: udacity/ud851-Exercises
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// Get access to underlying database (read-only for query)
final SQLiteDatabase db = mTaskDbHelper.getReadableDatabase();
// Write URI match code and set a variable to return a Cursor
int match = sUriMatcher.match(uri);
Cursor retCursor;
// Query for the tasks directory and write a default case
switch (match) {
// Query for the tasks directory
case TASKS:
retCursor = db.query(TABLE_NAME,
projection,
selection,
selectionArgs,
null,
null,
sortOrder);
break;
// Default exception
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
// Set a notification URI on the Cursor and return that Cursor
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
// Return the desired Cursor
return retCursor;
}
代码示例来源:origin: greenrobot/greenDAO
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
int uriType = sURIMatcher.match(uri);
switch (uriType) {
case SIMPLEENTITY_DIR:
queryBuilder.setTables(TABLENAME);
break;
case SIMPLEENTITY_ID:
queryBuilder.setTables(TABLENAME);
queryBuilder.appendWhere(PK + "="
+ uri.getLastPathSegment());
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
Database db = getDatabase();
Cursor cursor = queryBuilder.query(((StandardDatabase) db).getSQLiteDatabase(), projection, selection,
selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sort) {
SQLiteQueryBuilder qb=new SQLiteQueryBuilder();
qb.setTables(TABLE);
String orderBy;
if (TextUtils.isEmpty(sort)) {
orderBy=Constants.DEFAULT_SORT_ORDER;
}
else {
orderBy=sort;
}
Cursor c=
qb.query(db.getReadableDatabase(), projection, selection,
selectionArgs, null, null, orderBy);
c.setNotificationUri(getContext().getContentResolver(), url);
return(c);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sort) {
SQLiteQueryBuilder qb=new SQLiteQueryBuilder();
qb.setTables(TABLE);
String orderBy;
if (TextUtils.isEmpty(sort)) {
orderBy=Constants.DEFAULT_SORT_ORDER;
}
else {
orderBy=sort;
}
Cursor c=
qb.query(db.getReadableDatabase(), projection, selection,
selectionArgs, null, null, orderBy);
c.setNotificationUri(getContext().getContentResolver(), url);
return(c);
}
代码示例来源:origin: udacity/ud851-Sunshine
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
代码示例来源:origin: udacity/ud851-Sunshine
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
代码示例来源:origin: udacity/ud851-Sunshine
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
代码示例来源:origin: udacity/ud851-Sunshine
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
代码示例来源:origin: udacity/ud851-Sunshine
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
代码示例来源:origin: udacity/ud851-Sunshine
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
代码示例来源:origin: k9mail/k-9
cursor.setNotificationUri(contentResolver, notificationUri);
代码示例来源:origin: jgilfelt/chuck
@Override
@Nullable
public Cursor query(@NonNull Uri uri, @Nullable String[] projection,
@Nullable String selection, @Nullable String[] selectionArgs,
@Nullable String sortOrder) {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
Cursor cursor = null;
switch (matcher.match(uri)) {
case TRANSACTIONS:
cursor = LocalCupboard.getInstance().withDatabase(db).query(HttpTransaction.class).
withProjection(projection).
withSelection(selection, selectionArgs).
orderBy(sortOrder).
getCursor();
break;
case TRANSACTION:
cursor = LocalCupboard.getInstance().withDatabase(db).query(HttpTransaction.class).
byId(ContentUris.parseId(uri)).
getCursor();
break;
}
if (cursor != null) {
cursor.setNotificationUri(getContext().getContentResolver(), uri);
}
return cursor;
}
代码示例来源:origin: grandcentrix/tray
cursor.setNotificationUri(getContext().getContentResolver(), uri);
内容来源于网络,如有侵权,请联系作者删除!