Skip to content
Advertisement

How can i store uri.toString to my java class?

I want to store a uri to my donation.java class so that ill be able to fetch an image from firebase storage and display it on a cardview. However uri.toString is highlighted red and shows a “Cannot resolve constructor ‘donation(java.lang.String)'”

donate.java

JavaScript

donation.java

JavaScript

I’ve tried storing the uri to a different class which was successful but I had to make another list for myAdapter which added more problems to the table.

MyAdapter.java

JavaScript

So I want to know if there’s a possible work around for storing the uri to my donation class.

Advertisement

Answer

The line

JavaScript

will create a new donation from String. Probably this is not what is wanted. If the goal is to set imageUrl after the image is uploaded, then replace this line with:

JavaScript

And in donation.java, add setter for imageUrl:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement