Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setImageURI(url) is deprecated in Fresco. What to use instead?

I am using Fresco Android Library to get images from URLs. The images I get without any problem, but the thing is that the setImageURI(url) is deprecated.enter image description here So I could not find what to use instead. To avoid deprecated functions usage in my code.

like image 623
Armen Hovhannisian Avatar asked Jan 26 '18 15:01

Armen Hovhannisian


2 Answers

SimpleDraweeView#setImageURI(Uri) is actually @undeprecated (https://github.com/facebook/fresco/blob/master/drawee/src/main/java/com/facebook/drawee/view/SimpleDraweeView.java#L117) but this command is not a standard JavaDoc command and there is no better way to undeprecate something that has been marked as deprecated in a parent class.

However, you should use SimpleDraweeView#setImageURI(Uri uri, @Nullable Object callerContext) instead. The caller context can be null or it can be additional metadata (like a String TAG that can be used to better identify where image requests are coming from).

like image 50
Alexander Oprisnik Avatar answered Nov 03 '22 22:11

Alexander Oprisnik


You can also use this method: setImageURI(String uriPath)

val uriPath = arrayList!![position].getUrl()
draweeView.setImageURI(uriPath)
like image 30
Avijit Karmakar Avatar answered Nov 03 '22 23:11

Avijit Karmakar