is External Storage Writeable - Android android.os

Android examples for android.os:External Storage

Description

is External Storage Writeable

Demo Code

import android.os.Environment;
import android.os.StatFs;
import java.io.File;
import java.io.IOException;

public class Main{


     static Boolean isExternalStorageWriteable() {
        boolean mExternalStorageWriteable = false;
        String state = Environment.getExternalStorageState();

        if (Environment.MEDIA_MOUNTED.equals(state)
                && Environment.getExternalStorageDirectory().canWrite()) {
            mExternalStorageWriteable = true;
        }//from ww  w.ja v a  2s  . c om

        return mExternalStorageWriteable;
    }

}

Related Tutorials