I'm following this tutorial on how to Retrieve Uploaded Images from Firebase Storage to show in recyclerview. But when I run my app I don't see the uploaded images instead my app crashes and the error keeps pointing at this certain line that contains this code ImageUploadInfo imageUploadInfo = postSnapshot.getValue(ImageUploadInfo.class);
but its not really explaining why its an error. I'm not sure whats going on can someone please...pretty please help me I've been looking for answers on this all week and haven't gotten any. Thanks an advance
Errors:
FATAL EXCEPTION: main
Process: com.myapp.Gogo, PID: 22974
com.google.firebase.database.DatabaseException: Found two getters or fields
with conflicting case sensitivity for property: imageurl
2020-03-05 11:06:36.238 22974-22974/com.myapp.Gogo
E/RecyclerView: No adapter attached; skipping layout
Adapter Class:
public class AdapterOne extends RecyclerView.Adapter<AdapterOne.ViewHolder> {
Context context;
List <ImageUploadInfo> ImageUploadInfoList;
public AdapterOne(Context c, List<ImageUploadInfo> TempList){
this.ImageUploadInfoList=TempList;
this.context=c;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view=LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview,parent,false);
ViewHolder viewHolder=new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
ImageUploadInfo imageUploadInfo=ImageUploadInfoList.get(position);
//loading image with glide libary
Glide.with(context).load(imageUploadInfo.getImageUrl()).into(holder.imageView);
}
@Override
public int getItemCount() {
return ImageUploadInfoList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
imageView=(ImageView) itemView.findViewById(R.id.imageview);
}
}
}
ImageUpload.class:
public class ImageUploadInfo {
public String imageURL;
public ImageUploadInfo( String url) {
//this.imageName = name;
this.imageURL= url;
}
public String getImageUrl() {
return null;
}
}
This is the main page:
if(firebaseUser!=null) {
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference("Users");
DatabaseReference uidRef = rootRef.child("images").child(uid);
uidRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
ImageUploadInfo imageUploadInfo = postSnapshot.getValue(ImageUploadInfo.class);
list.add(imageUploadInfo);
}
adapter1 = new AdapterOne(getApplicationContext(), list);
recyclerView.setAdapter(adapter1);
}
@Override
public void onCancelled(DatabaseError databaseError) {}
});
}