How I can get the image from the Assets folder and not from android.os.Environment.getExternalStorageDirectory()?
I need to replace this code as per my requirement:
File directory = new File(
android.os.Environment.getExternalStorageDirectory()
+ File.separator + AppConstant.PHOTO_ALBUM);
Thanks
EDIT:
ArrayList filePaths = new ArrayList();
if (directory.isDirectory()) {
File[] listFiles = directory.listFiles();
if (listFiles.length > 0) {
for (int i = 0; i < listFiles.length; i++) {
String filePath = listFiles[i].getAbsolutePath();
if (IsSupportedFile(filePath)) {
filePaths.add(filePath);
}
}
} else {
Toast.makeText(
_context,
AppConstant.PHOTO_ALBUM
+ " is empty. Please load some images in it !",
Toast.LENGTH_LONG).show();
}
} else {
AlertDialog.Builder alert = new AlertDialog.Builder(_context);
alert.setTitle("Error!");
alert.setMessage(AppConstant.PHOTO_ALBUM
+ " directory path is not valid! Please set the image directory name AppConstant.java class");
alert.setPositiveButton("OK", null);
alert.show();
}