I have used TedBottomPicker library for image selection. Here is the link: https://android-arsenal.com/details/1/4320 . I need to get the image selection from every folder of gallery not just from Pictures folder (as done in the source code of this library). I have downloaded the code and edited TedBottomPicker.java on line 446 as (DIRECTORY_PICTURES to DIRECTORY_DOCUMENTS). which works fine when i launch the app, it selects images from every folder such as camera, whatsapp,etc.
Now problem is Once I import this library as module to my project and changed DIRECTORY_PICTURES to DIRECTORY_DOCUMENTS in its source code, it will still just showing the images from Pictures folder. I follow this link to import my library: Android studio - add library from github Tell me why my applied change in the java file is not going to show in my android project. Thanks in advance Here is code of external Library method:
private File getImageFile() {
// Create an image file name
File imageFile = null;
try {
String timeStamp = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
if (!storageDir.exists())
storageDir.mkdirs();
imageFile = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
cameraImageUri = Uri.fromFile(imageFile);
} catch (IOException e) {
e.printStackTrace();
errorMessage("Could not create imageFile for camera");
}
return imageFile;
}
and i have used this code in my Activity:
`
if(tempImageList.size()>0){
//Loading with previous selection
bottomSheetDialogFragment = new TedBottomPicker.Builder(MessagesActivity.this)
.setOnMultiImageSelectedListener(new TedBottomPicker.OnMultiImageSelectedListener() {
@Override
public void onImagesSelected(ArrayList<Uri> uriList) {
tempImageList = uriList;
for (int i = 0; i < tempImageList.size(); i++) {
Uri uri=tempImageList.get(i); //setting selected images in my variable
System.out.print("myUri"+ uri);
}
}
})
.setPeekHeight(1000)
.showTitle(false)
.setCompleteButtonText("Done")
.setEmptySelectionText("No Select")
.setSelectedUriList(tempImageList)
.create();
bottomSheetDialogFragment.show(getSupportFragmentManager());
} else {
//Loading New
bottomSheetDialogFragment = new TedBottomPicker.Builder(MessagesActivity.this)
.setOnMultiImageSelectedListener(new TedBottomPicker.OnMultiImageSelectedListener() {
@Override
public void onImagesSelected(ArrayList<Uri> uriList) {
tempImageList=uriList;
}
})
.setPeekHeight(1000)
.showTitle(false)
.setCompleteButtonText("Done")
.setEmptySelectionText("No Select")
.create();
bottomSheetDialogFragment.show(getSupportFragmentManager());
}