Get url inside recyclerview from firebase | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Get url inside recyclerview from firebase

Hello, I have a problem with finding the right way to write code to retrieve an url that is stored in firebase. Let me describe how it should work, and then how the steucture of the java code looks like. A user can enter a country page, for example Canada. Inside this page, there is a list of information such as "see and do". Users can insert a list item, and therefore have to add a few items such as an url and a name that descibes the url. Only the desciption is displayed, and when clicked by other users it should open the url. Both values are stored in Firebase. The list is inside a recyclerview. In big lines, this is how the structure of the code looks like: The countrypage is an activity, that calls information from the SeeDoAdapter and SeeDoViewholder, which are both in a seperate page. At the moment, I'm able to write an intent that opens a hard coded url, but I'm not able to retrieve the url from Firebase yet. Can anybody send me in the right direction? Where do I need to write which code? Thanks!!!

3rd Jun 2020, 4:12 PM
BikingBass
2 Answers
0
Why are you relying on URLs. I mean structure your Firebase in such a way that it can be accessed by using user specified attributes. Your query should look like firebasereference.getInstance().child("your attribute");
3rd Jun 2020, 4:43 PM
Hardik Sharma
Hardik Sharma - avatar
0
The url is a value in my firebase structure, so I'm using the FirebaseDatabase.getinstance().getReference().child("countries").child("see_do") to access the specific values.
3rd Jun 2020, 5:27 PM
BikingBass