Example usage for android.os Environment MEDIA_UNKNOWN

List of usage examples for android.os Environment MEDIA_UNKNOWN

Introduction

In this page you can find the example usage for android.os Environment MEDIA_UNKNOWN.

Prototype

String MEDIA_UNKNOWN

To view the source code for android.os Environment MEDIA_UNKNOWN.

Click Source Link

Document

Unknown storage state, such as when a path isn't backed by known storage media.

Usage

From source file:Main.java

/**
 * Returns the current state of the storage device that provides the given path.
 * @param state "getExternalStorageState()"
 *//*w  w w.  ja v a 2 s . c om*/
public static String getExternalStorageState(String state) {
    if (TextUtils.isEmpty(state)) {
        return UNKNOWN;
    }

    switch (state) {
    case Environment.MEDIA_BAD_REMOVAL://bad_removal
        return "MEDIA_BAD_REMOVAL";
    case Environment.MEDIA_CHECKING://checking
        return "MEDIA_CHECKING";
    case Environment.MEDIA_EJECTING://ejecting
        return "MEDIA_EJECTING";
    case Environment.MEDIA_MOUNTED://mounted
        return "MEDIA_MOUNTED";
    case Environment.MEDIA_MOUNTED_READ_ONLY://mounted_read_only
        return "MEDIA_MOUNTED_READ_ONLY";
    case Environment.MEDIA_NOFS://nofs
        return "MEDIA_NOFS";
    case Environment.MEDIA_REMOVED://removed
        return "MEDIA_REMOVED";
    case Environment.MEDIA_SHARED://shared
        return "MEDIA_SHARED";
    case Environment.MEDIA_UNKNOWN://unknown
        return "MEDIA_UNKNOWN";
    case Environment.MEDIA_UNMOUNTABLE://unmountable
        return "MEDIA_UNMOUNTABLE";
    case Environment.MEDIA_UNMOUNTED://unmounted
        return "MEDIA_UNMOUNTED";
    default:
        return UNKNOWN;
    }
}