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

ir2pid picture ir2pid · May 1, 2015 · Viewed 43.1k times · Source

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?

Answer

Sam Judd picture Sam Judd · May 1, 2015

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);