Checks if external storage is available to at least read - Android Hardware

Android examples for Hardware:SD Card

Description

Checks if external storage is available to at least read

Demo Code


//package com.java2s;

import android.os.Environment;

public class Main {
    /** Checks if external storage is available to at least read  */
    public static boolean isExternalStorageReadable() {
        String state = Environment.getExternalStorageState();
        if (Environment.MEDIA_MOUNTED.equals(state)
                || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
            return true;
        }// w  w w  .ja va 2s. c o m
        return false;
    }
}

Related Tutorials