Example usage for android.provider MediaStore getMediaScannerUri

List of usage examples for android.provider MediaStore getMediaScannerUri

Introduction

In this page you can find the example usage for android.provider MediaStore getMediaScannerUri.

Prototype

public static Uri getMediaScannerUri() 

Source Link

Document

Uri for querying the state of the media scanner.

Usage

From source file:Main.java

public static boolean isMediaScannerScanning(Context context) {
    boolean result = false;
    Cursor cursor = query(context, MediaStore.getMediaScannerUri(),
            new String[] { MediaStore.MEDIA_SCANNER_VOLUME }, null, null, null);
    if (cursor != null) {
        if (cursor.getCount() == 1) {
            cursor.moveToFirst();// ww w  .  j  av  a  2  s . c om
            result = "external".equals(cursor.getString(0));
        }
        cursor.close();
    }

    return result;
}

From source file:Main.java

public static boolean isMediaScannerScanning(Context context) {
    boolean result = false;

    Cursor cursor = query(context, MediaStore.getMediaScannerUri(),
            new String[] { MediaStore.MEDIA_SCANNER_VOLUME }, null, null, null);
    if (cursor != null) {
        if (cursor.getCount() == 1) {
            cursor.moveToFirst();/*from w w  w . ja  v  a2s .co m*/
            result = "external".equals(cursor.getString(0));
        }
        cursor.close();
    }

    return result;
}

From source file:com.xmobileapp.rockplayer.RockPlayer.java

/**********************************************
 * // w  w  w .  j a  v  a  2  s  .c o  m
 * External function from MusicUtils.java of 
 * Android's Music App
 * 
 * --- still needs to be tested
 *
 **********************************************/
public boolean isMediaScannerScanning(Context context, ContentResolver contentResolver) {
    boolean result = false;
    Cursor cursor = contentResolver.query(MediaStore.getMediaScannerUri(),
            new String[] { MediaStore.MEDIA_SCANNER_VOLUME }, null, null, null);
    if (cursor != null) {
        if (cursor.getCount() == 1) {
            cursor.moveToFirst();
            result = "external".equals(cursor.getString(0));
        }
        cursor.close();
    }

    return result;
}