I am developing an android application of Image gallery view. So I run a for loop as shown below to get ArrayList of uri string of all jpeg, jpg and png files. So in executing this process it takes around 50-60 secends. ( This for loop is running on AsyncTask). Is there any way I can get the task quicker.
// I am passing Environment.getExternalStorageDirectory() to this function
public void fileextractor(File raw){
File[] files = raw.listFiles();
for(int i=0; i<files.length;i++){
if(files[i].isDirectory()){fileextractor(files[i]);}
else {
IMGS[imageCounter] = (Uri.fromFile(files[i]).toString());
//IMGS is String[];
imageCounter++;
}
}
}