Checks if media storage (SD card) is available. - Android Hardware

Android examples for Hardware:SD Card

Description

Checks if media storage (SD card) is available.

Demo Code


//package com.java2s;

import android.os.Environment;

public class Main {
    /**// www. j a v a  2  s.  c  o  m
     * Checks if media storage (SD card) is available.
     * @return <code>true</code> if available
     */
    public static boolean isMediaStorageAvailable() {
        return (Environment.getExternalStorageState()
                .equals(Environment.MEDIA_MOUNTED));
    }
}

Related Tutorials