Reputation: 309
I am trying to load images, videos and whatever the screenshots into RecyclerView
from Gallery. When click on the RecyclerView
item need to highlight with listselector and need to get the list of selected paths. can any one suggest to do this. Like the following image:
Upvotes: 2
Views: 2174
Reputation: 1928
For multiple image picker, follow this link DroidNinja Filepicker
Make Adapter and POJO class to view those selected photo on RecycelrView
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case FilePickerConst.REQUEST_CODE_PHOTO:
if (resultCode == Activity.RESULT_OK && data != null) {
filePaths.addAll(data.getStringArrayListExtra(FilePickerConst.KEY_SELECTED_PHOTOS));
Image img;
ArrayList<Image> images = new ArrayList<>();
try {
for (String path : filePaths) {
img = new Image();
img.setUri(Uri.fromFile(new File(path)));
Log.e("VIDEO", Uri.fromFile(new File(path)) + "");
images.add(img);
}
rvPhoto.setAdapter(new MyAdapter(this, images));
} catch (Exception e) {
e.printStackTrace();
}
}
break;
}
Upvotes: 1