I want to check that folder is empty or not.
File dir = new File(Environment.getExternalStorageDirectory() + "/media_files");
if (dir.exists() && dir.isDirectory()) {
File[] contents = dir.listFiles();
if (contents == null) {
//Always run this code
storeListing();
} else if (contents.length == 0) {
storeListing();
} else {
selectStore();
}
} else {
storeListing();
}
having permissions
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Contents always shows empty. But I have video files in media_files folder. here is logcat
08-10 12:49:55.265 24523-24523/com.css.css I/art: Late-enabling -Xcheck:jni 08-10 12:49:55.438 24523-24523/com.css.css W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 08-10 12:49:55.493 24523-24523/com.abc.css D/URL =: http://...... 08-10 12:49:55.522 24523-24579/com.abc.css D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 08-10 12:49:55.558 24523-24579/com.abc.css I/Adreno-EGL: : QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb 08-10 12:49:55.559 24523-24579/com.abc.css I/OpenGLRenderer: Initialized EGL, version 1.4 08-10 12:49:57.531 24523-24523/com.abc.css D/Response ==>: {"store":{"id":1,"name":"tib","template_id":3,"template":{"gfram":[{.... 08-10 12:51:05.891 24523-24529/com.abc.css I/art: Debugger is no longer active
Your suggestion will be appreciated