Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Glide for Android, how do I load images from asset and resources?

I want to keep all the transformation, stoke and animations identical and was thinking if we can pass resource ID or asset name in Glide to load it locally?

like image 657
ir2pid Avatar asked May 01 '15 06:05

ir2pid


People also ask

How do you download pictures from Glide?

To simply load an image to LinearLayout, we call the with() method of Glide class and pass the context, then we call the load() method, which contains the URL of the image to be downloaded and finally we call the into() method to display the downloaded image on our ImageView.


1 Answers

For resource ids, you can use:

Glide.with(fragment)     .load(R.drawable.resource_id)     .into(imageView); 

For assets, you can construct an asset uri:

Glide.with(fragment)     .load(Uri.parse("file:///android_asset/<assetName>"))     .into(imageView); 
like image 87
Sam Judd Avatar answered Sep 20 '22 22:09

Sam Judd