In my Android App, the Captured image along with its details is stored and displayed in a recycler View. The Details are name and description of the picture. I'm storing the details along with Storage path(mCurrentpath) of the captured image in a room database table. I'm able to retrieve each row of the database and display it in recyclerview item. The problem is - if I try to save only the details without any picture captured,the item displays an empty imageview along with details. Instead of displaying empty image view i need to display an default image.Kindly help Note: i also tried to save a default string in database if image not captured. and checked With if() statement in onBindViewHolder
@Override
public void onBindViewHolder(@NonNull ImageHolder imageHolder, int i) {
ImageEntry currentImageEntry = imageEntries.get(i);
String storedAddress = currentImageEntry.getImageStoredAddress();
if(storedAddress != "Address is null") {
imageHolder.imageView.setImageBitmap(BitmapFactory.decodeFile(currentImageEntry.getImageStoredAddress()));
}else {imageHolder.imageView.setImageResource(R.drawable.default_image);}
imageHolder.textViewTpye.setText(currentImageEntry.getPropertyType());
imageHolder.textViewDesc.setText(currentImageEntry.getProprtyDescription());
}
thanks