I am using RecyclerView in Android and I am having some trouble with images.
I would like to display a list of the images in a particular folder with their path name
It takes time to mold the code using caching method and loading images before the fragment is displayed. An easy approach would be to use the Picasso Library. I myself used Picasso and now images load quite fast as I scroll.
Here is my code:
public void bindPhoto(Photo photo) {
mPhoto = photo;
mPhotoFile=PhotoLab.get(getActivity()).getPhotoFile(mPhoto);
Uri uri=Uri.fromFile(mPhotoFile);
if(mPhotoFile==null || !mPhotoFile.exists()){
int imgdrawable=R.drawable.ic_action_name3;
mThumbnail.setImageDrawable(getResources().getDrawable(imgdrawable));
} else {
Picasso.with(getActivity()).load(uri).fit().into(mThumbnail);
}
mTitleTextView.setText(mPhoto.getTitle());
String dateFormat = "EEE, MMM dd";
dateString = DateFormat.format(dateFormat, mPhoto.getDate()).toString();
mDateTextView.setText(dateString);
}