Detect whether SD card has mounted or not. - Android Hardware

Android examples for Hardware:SD Card

Description

Detect whether SD card has mounted or not.

Demo Code


//package com.java2s;

public class Main {
    /**//from  w w w.j a v a  2  s . c om
     * Detect whether SD card has mounted or not.
     * 
     * @author Sean Zheng
     * @CreateDate 2013-4-23
     */
    public static boolean hasMountSDCard() {
        return android.os.Environment.getExternalStorageState().equals(
                android.os.Environment.MEDIA_MOUNTED);
    }
}

Related Tutorials