is Storage Ready - Android android.os

Android examples for android.os:Environment

Description

is Storage Ready

Demo Code

import android.os.Environment;

public class Main {

  public static boolean isStorageReady() {
    String cardstatus = Environment.getExternalStorageState();
    if (cardstatus.equals(Environment.MEDIA_REMOVED) || cardstatus.equals(Environment.MEDIA_UNMOUNTED)
        || cardstatus.equals(Environment.MEDIA_UNMOUNTABLE) || cardstatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
      return false;
    } else {/*from w ww.j  a  va 2s.c  om*/
      if (cardstatus.equals(Environment.MEDIA_MOUNTED)) {
        return true;
      } else {
        return false;
      }
    }
  }

}

Related Tutorials