Code example for AsyncQueryHandler

Methods: startQuery

0
        Uri uri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI;
        if (!TextUtils.isEmpty(filter)) {
            uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
        } 
        if (async != null) {
            async.startQuery(0, null,
                    uri,
                    cols, null, null, MediaStore.Audio.Genres.DEFAULT_SORT_ORDER);
        } else { 
            ret = MusicUtils.query(this, uri,
                    cols, null, null, MediaStore.Audio.Genres.DEFAULT_SORT_ORDER);
        } 
        return ret;
    } 
 
    @Override 
    protected long fetchCategoryId(Cursor cursor) {
        return cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Audio.Genres._ID));
    } 
 
    @Override