问题
I am attempting to load images into a recyclerview from the Parse web service. For this I will need:
A. A query which retrieves, based on criteria, images by category in the form of a List. Now, I have been able to find ways to do this with ParseObjects, but not ParseFiles such as images.
B. A way to extract the images from the List of ParseFiles and to load them into a List of an object which can store these images, even though they do not have a local ID. They must then be loaded into the recyclerview.
I am sorry I have no more information. The parse docs provide little relevant information, and there are no helpful resources that I have been able to find. I do not, for example, provide code, because my code is that of a generic recyclerview. I could post code from the parse docs, but that is a waste of space. I apologize sincerely if this may seem like a large request, and it probably is, but I have found no help online and I really need this.
Apologetically,
Geffen Avraham
回答1:
You can find a guide of creating queries in the documentation to ParseQuery
class.
Each ParseFile has method getUrl()
which lets you to push that url to some image loading library such as Picasso, Glide or UIL. This libraries provide the ways to download, display, cache and even store images on the disc.
So the way you can implement your task is to construct query with actual constraints, then call the method query.findInBackground()
and in the method done()
of query callback send received list to RecyclerView adapter in which inside the method onBindViewHolder()
pass the image url to load to ImageView in corresponding ViewHolder
来源:https://stackoverflow.com/questions/31796122/parse-recyclerview-image-query