Java Code Examples for android.os.Environment.MEDIA_UNMOUNTABLE

The following are Jave code examples for showing how to use MEDIA_UNMOUNTABLE of the android.os.Environment class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Accessibility   File:   View Source Code Vote up 6 votes
private static String getStorageVolumeStats(Object service, Object storageVolume, String path) {
    try {
        Class<? extends Object> StorageVolumeClass = storageVolume.getClass();
        Method getState = StorageVolumeClass.getMethod("getState");
        return (String) getState.invoke(storageVolume);
    } catch (Exception e) {
        try {
            Class IMountService = service.getClass();
            Method getVolumeState = IMountService.getMethod("getVolumeState", String.class);
            return (String) getVolumeState.invoke(service, path);
        } catch (Exception e1) {
    return Environment.MEDIA_UNMOUNTABLE;