Java Code Examples for android.database.Cursor.deactivate()

The following are Jave code examples for showing how to use deactivate() of the android.database.Cursor class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: q-mail   File: MergeCursor.java   Source Code and License Vote up 5 votes
@Override
public void deactivate() {
    for (Cursor cursor : mCursors) {
        if (cursor != null) {
            cursor.deactivate();
        }
    }
}
 
Example 2
Project: buildAPKsApps   File: DbAccessor.java   Source Code and License Vote up 5 votes
public int getMinimumBrightness() {
  Cursor c = rDb.query(DbHelper.DB_TABLE_CALIBRATE,
      new String[] { DbHelper.CALIB_MIN_BRIGHT_COL }, null, null, null, null,
      null);
  c.moveToFirst();
  int b = c.getInt(c.getColumnIndexOrThrow(DbHelper.CALIB_MIN_BRIGHT_COL));
  c.deactivate();
  c.close();
  return b;
}
 
Example 3
Project: aos-MediaLib   File: VideoProvider.java   Source Code and License Vote up 5 votes
@Override
public String getType(Uri url) {
    if (DBG) Log.d(TAG, "getType" + url);

    // determine match
    int match = URI_MATCHER.match(url);

    // let ScraperProvider handle what it can
    if (ScraperProvider.handles(match))
        return mScraperProvider.getType(url);

    // return what we can
    switch (match) {
        case VIDEO_MEDIA_ID:
        case FILES_ID:
            Cursor c = null;
            try {
                c = query(url, MIME_TYPE_PROJECTION, null, null, null);
                if (c != null && c.getCount() == 1) {
                    c.moveToFirst();
                    String mimeType = c.getString(1);
                    c.deactivate();
                    return mimeType;
                }
            } finally {
                if (c != null) {
                    c.close();
                }
            }
            break;

        case VIDEO_MEDIA:
            return Video.Media.CONTENT_TYPE;
    }
    throw new IllegalStateException("Unknown URL : " + url);
}
 
Example 4
Project: aos-MediaLib   File: MusicProvider.java   Source Code and License Vote up 4 votes
@Override
public String getType(Uri url) {
    if (DBG) Log.d(TAG, "getType" + url);

    // determine match
    int match = URI_MATCHER.match(url);

    // return what we can
    switch (match) {
        case AUDIO_MEDIA_ID:
        case AUDIO_PLAYLISTS_ID_MEMBERS_ID:
        case FILES_ID:
            Cursor c = null;
            try {
                c = query(url, MIME_TYPE_PROJECTION, null, null, null);
                if (c != null && c.getCount() == 1) {
                    c.moveToFirst();
                    String mimeType = c.getString(1);
                    c.deactivate();
                    return mimeType;
                }
            } finally {
                if (c != null) {
                    c.close();
                }
            }
            break;

        case AUDIO_ALBUMART_ID:
            return "image/jpeg";

        case AUDIO_MEDIA:
        case AUDIO_GENRES_ID_MEMBERS:
        case AUDIO_PLAYLISTS_ID_MEMBERS:
            return Audio.Media.CONTENT_TYPE;

        case AUDIO_GENRES:
        case AUDIO_MEDIA_ID_GENRES:
            return Audio.Genres.CONTENT_TYPE;
        case AUDIO_GENRES_ID:
        case AUDIO_MEDIA_ID_GENRES_ID:
            return Audio.Genres.ENTRY_CONTENT_TYPE;
        case AUDIO_PLAYLISTS:
        case AUDIO_MEDIA_ID_PLAYLISTS:
            return Audio.Playlists.CONTENT_TYPE;
        case AUDIO_PLAYLISTS_ID:
        case AUDIO_MEDIA_ID_PLAYLISTS_ID:
            return Audio.Playlists.ENTRY_CONTENT_TYPE;
        case AUDIO_ALBUMS_ID:
            return Audio.Albums.CONTENT_TYPE;
        case AUDIO_ARTISTS_ID:
            return Audio.Artists.CONTENT_TYPE;
    }
    throw new IllegalArgumentException("Unsupported URI: " + url);
}