Example usage for android.content AsyncQueryHandler startQuery

List of usage examples for android.content AsyncQueryHandler startQuery

Introduction

In this page you can find the example usage for android.content AsyncQueryHandler startQuery.

Prototype

public void startQuery(int token, Object cookie, Uri uri, String[] projection, String selection,
        String[] selectionArgs, String orderBy) 

Source Link

Document

This method begins an asynchronous query.

Usage

From source file:co.codecrunch.musicplayerlite.childfragment.ChildFragmentGenres.java

private Cursor getGenersCursor(AsyncQueryHandler async, String filter) {

    String[] cols = new String[] { MediaStore.Audio.Genres._ID, MediaStore.Audio.Genres.NAME };

    Uri uri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }/*w w  w .  ja v a  2 s  .co  m*/

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, uri, cols, null, null, null);
    } else {
        ret = MusicPlayerUtility.query(getActivity(), uri, cols, null, null, null);
    }
    return ret;
}

From source file:com.dmplayer.childfragment.ChildFragmentGenres.java

private Cursor getGenersCursor(AsyncQueryHandler async, String filter) {

    String[] cols = new String[] { MediaStore.Audio.Genres._ID, MediaStore.Audio.Genres.NAME };

    Uri uri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }/*from   w w w  . j  a v  a2s . c om*/

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, uri, cols, null, null, null);
    } else {
        ret = DMPlayerUtility.query(getActivity(), uri, cols, null, null, null);
    }
    return ret;
}

From source file:in.risysnetworks.shplayer.fragments.childfragment.ChildFragmentGenres.java

private Cursor getGenersCursor(AsyncQueryHandler async, String filter) {

    String[] cols = new String[] { MediaStore.Audio.Genres._ID, MediaStore.Audio.Genres.NAME };

    Uri uri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }/*from   ww w.ja  v  a 2  s.com*/

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, uri, cols, null, null, null);
    } else {
        ret = SHPlayerUtility.query(getActivity(), uri, cols, null, null, null);
    }
    return ret;
}

From source file:co.codecrunch.musicplayerlite.childfragment.ChildFragmentAlbum.java

private Cursor getAlbumCursor(AsyncQueryHandler async, String filter) {
    String[] cols = new String[] { MediaStore.Audio.Albums._ID, MediaStore.Audio.Albums.ARTIST,
            MediaStore.Audio.Albums.ALBUM, MediaStore.Audio.Albums.ALBUM_ART };

    Cursor ret = null;/*w  ww  .j  a  v a 2s  .c o m*/
    Uri uri = MediaStore.Audio.Albums.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.Albums.DEFAULT_SORT_ORDER);
    } else {
        ret = MusicPlayerUtility.query(getActivity(), uri, cols, null, null,
                MediaStore.Audio.Albums.DEFAULT_SORT_ORDER);
    }
    return ret;
}

From source file:com.dmplayer.childfragment.ChildFragmentAlbum.java

private Cursor getAlbumCursor(AsyncQueryHandler async, String filter) {
    String[] cols = new String[] { MediaStore.Audio.Albums._ID, MediaStore.Audio.Albums.ARTIST,
            MediaStore.Audio.Albums.ALBUM, MediaStore.Audio.Albums.ALBUM_ART };

    Cursor ret = null;/*from  ww  w.jav a2 s .com*/
    Uri uri = MediaStore.Audio.Albums.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.Albums.DEFAULT_SORT_ORDER);
    } else {
        ret = DMPlayerUtility.query(getActivity(), uri, cols, null, null,
                MediaStore.Audio.Albums.DEFAULT_SORT_ORDER);
    }
    return ret;
}

From source file:com.dmplayer.childfragment.ChildFragmentArtists.java

private Cursor getArtistCursor(AsyncQueryHandler async, String filter) {

    String[] cols = new String[] { MediaStore.Audio.Artists._ID, MediaStore.Audio.Artists.ARTIST,
            MediaStore.Audio.Artists.NUMBER_OF_ALBUMS, MediaStore.Audio.Artists.NUMBER_OF_TRACKS };

    Uri uri = MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }//from   ww w. j ava2s  .  c  o  m

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, uri, cols, null, null, MediaStore.Audio.Artists.ARTIST_KEY);
    } else {
        ret = DMPlayerUtility.query(getActivity(), uri, cols, null, null, MediaStore.Audio.Artists.ARTIST_KEY);
    }
    return ret;
}

From source file:co.codecrunch.musicplayerlite.childfragment.ChildFragmentArtists.java

private Cursor getArtistCursor(AsyncQueryHandler async, String filter) {

    String[] cols = new String[] { MediaStore.Audio.Artists._ID, MediaStore.Audio.Artists.ARTIST,
            MediaStore.Audio.Artists.NUMBER_OF_ALBUMS, MediaStore.Audio.Artists.NUMBER_OF_TRACKS };

    Uri uri = MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }/*from w  w  w .java  2s . c om*/

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, uri, cols, null, null, MediaStore.Audio.Artists.ARTIST_KEY);
    } else {
        ret = MusicPlayerUtility.query(getActivity(), uri, cols, null, null,
                MediaStore.Audio.Artists.ARTIST_KEY);
    }
    return ret;
}

From source file:in.risysnetworks.shplayer.fragments.childfragment.ChildFragmentArtists.java

private Cursor getArtistCursor(AsyncQueryHandler async, String filter) {

    String[] cols = new String[] { MediaStore.Audio.Artists._ID, MediaStore.Audio.Artists.ARTIST,
            MediaStore.Audio.Artists.NUMBER_OF_ALBUMS, MediaStore.Audio.Artists.NUMBER_OF_TRACKS };

    Uri uri = MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }// ww w .  j a  va  2  s . com

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, uri, cols, null, null, MediaStore.Audio.Artists.ARTIST_KEY);
    } else {
        ret = SHPlayerUtility.query(getActivity(), uri, cols, null, null, MediaStore.Audio.Artists.ARTIST_KEY);
    }
    return ret;
}

From source file:in.risysnetworks.shplayer.fragments.childfragment.ChildFragmentAlbum.java

private Cursor getAlbumCursor(AsyncQueryHandler async, String filter) {
    String[] cols = new String[] { MediaStore.Audio.Albums._ID, MediaStore.Audio.Albums.ARTIST,
            MediaStore.Audio.Albums.ALBUM, MediaStore.Audio.Albums.ALBUM_ART };

    Cursor ret = null;//www.  j av  a 2s.  c  o m
    Uri uri = MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI;
    if (!TextUtils.isEmpty(filter)) {
        uri = uri.buildUpon().appendQueryParameter("filter", Uri.encode(filter)).build();
    }
    if (async != null) {

        System.out.println(" async != null ");

        async.startQuery(0, null, uri, cols, null, null, MediaStore.Audio.Albums.DEFAULT_SORT_ORDER);
    } else {

        System.out.println(" async == null ");

        ret = SHPlayerUtility.query(getActivity(), uri, cols, null, null,
                MediaStore.Audio.Albums.DEFAULT_SORT_ORDER);
    }
    return ret;
}

From source file:com.andrew.apolloMod.activities.QueryBrowserActivity.java

private Cursor getQueryCursor(AsyncQueryHandler async, String filter) {
    if (filter == null) {
        filter = "";
    }/* w  w  w. j  a v a  2  s .c  o  m*/
    String[] ccols = new String[] { BaseColumns._ID, Audio.Media.MIME_TYPE, Audio.Artists.ARTIST,
            Audio.Albums.ALBUM, Audio.Media.TITLE, "data1", "data2" };

    Uri search = Uri.parse("content://media/external/audio/search/fancy/" + Uri.encode(filter));

    Cursor ret = null;
    if (async != null) {
        async.startQuery(0, null, search, ccols, null, null, null);
    } else {
        ret = MusicUtils.query(this, search, ccols, null, null, null);
    }
    return ret;
}