Here you can find the source of isExternalStoragePresent()
private static boolean isExternalStoragePresent()
//package com.java2s; /*// ww w . j a v a 2s. c om * Copyright 2013 Nagendra K Srivastava. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.os.Environment; public class Main { /** * <b><i>private static boolean isExternalStoragePresent()</b></i></p> * this method can used to check that external storage(Sd card on device ) is available on device or not * @return {@link bool} * */ private static boolean isExternalStoragePresent() { boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else { mExternalStorageAvailable = mExternalStorageWriteable = false; } if (!((mExternalStorageAvailable) && (mExternalStorageWriteable))) { } return (mExternalStorageAvailable) && (mExternalStorageWriteable); } }