Hope This Might Help You !!!
use this code to Checking media availability in **inbuilt external storage.**
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
do your code depend on that
I'd recommend reading [storage options][1] on developer.android.com.
To check external memory is available (taken from developer.android.com):
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
To read internal files use `context.fileList();` see more [here][2].
**Edit**
I'm not sure what you want with 2 and 3. You can use mediascan to many things but using it just for using it sounds unproductive. For that I'd recommend @Singularity advice. There is a post [here about using mediascan for pdfs][3].
[1]: http://developer.android.com/guide/topics/data/data-storage.html
[2]: http://developer.android.com/reference/android/content/Context.html#fileList%28%29
[3]: https://stackoverflow.com/q/10384080/969325