Created
May 13, 2019 09:53
-
-
Save CodeBoy722/413ab10aa79885f0228b8a4543604183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ArrayList<pictureFacer> getAllImagesByFolder(String path){ | |
ArrayList<pictureFacer> images = new ArrayList<>(); | |
Uri allVideosuri = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | |
String[] projection = { MediaStore.Images.ImageColumns.DATA ,MediaStore.Images.Media.DISPLAY_NAME, | |
MediaStore.Images.Media.SIZE}; | |
Cursor cursor = ImageDisplay.this.getContentResolver().query( allVideosuri, projection, MediaStore.Images.Media.DATA + " like ? ", new String[] {"%"+path+"%"}, null); | |
try { | |
cursor.moveToFirst(); | |
do{ | |
pictureFacer pic = new pictureFacer(); | |
pic.setPicturName(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME))); | |
pic.setPicturePath(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA))); | |
pic.setPictureSize(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE))); | |
images.add(pic); | |
}while(cursor.moveToNext()); | |
cursor.close(); | |
ArrayList<pictureFacer> reSelection = new ArrayList<>(); | |
for(int i = images.size()-1;i > -1;i--){ | |
reSelection.add(images.get(i)); | |
} | |
images = reSelection; | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return images; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment