Development issue/problem:

Can you load a Rendition from a subfolder of the Assets folder (not the Rendering folder)?

How can I solve this problem?

Solution 1:

I hope this helps you:

Drawable d = Drawable.createFromStream(getAssets().open(Cloths/btn_no.png), null) ;

Solution 2:

I recommend the use of this

Drawable.createFromResourceStream(resources,new TypedValue(), resources.getAssets().open(filename), null)

This makes it possible to borrow funds in such a way that…

Solution 3:

Here is a class with a static method for retrieving selectable assets. The input current is also disappearing.

import android.content.context;
import Drawable;

Import ;

* Created by Bartburg on 11-4-2015.
public class AssetReader {

public static getDrawableFromAssets(Context context, String url){
Drawable drawable = null;
InputStream inputStream = null;
try {
inputStream = context.getAssets().open(url);
drawable = Drawable.createFromStream(inputStream, null);
} catch (IOException e) {
} finally {
if(inputStream != zero) {
try {
} catch (IOException e) {
} Returned

Solution 4:

Yes, you can create a Drawable object from an InputStream using the createFromStream() method.

Solution No 5:

Here’s a story that does that for you.

Check for the presence of zero in a stretch return variable, because the value zero can be returned if the path is invalid or if there is an IOException.

public static drawing getDrawableFromAssetFolder(String fullPath, Activity ctx) {
Drawable d =null;
try {
d = Drawable.createFromStream(ctx).getAssets().open(fullPath), null);
} catch (IOException e) {
// TODO auto-generation catch block
return d;

Solution No 6:

It allowed to obtain the right density

private DrawableFromAssetFilename(filename string) {
AssetManager assetManager = mApplicationContext.getAssets();
InputStream inputStream = null;
try {
inputStream =;
} catch (IOException e) {
Bitmap bitmap = BitmapFactory.decodeStream(inputStream) ;

BitmapDrawable Drawable = new BitmapDrawable(mApplicationContext.getResources(), bitmap);
return drawable;

Solution No 7:

I worked in the RecyclerView adapter and found out that David’s answer didn’t work for me (for some reason remained unsolved, which I also imported).

So I thought it worked for me (code Kotlin).

fall d = Drawable.createFromStream(context ?.assets ?.open(imageData/${imageName}.png), null)

here is my directory, as you can see the assets start with the assets directory, and here is a link on how to create this assets directory

Solution No 8:

In this version, if you create a subdirectory in the image folder that cannot be used in the xml file, it will not be recognized when using android:src.

Look at this wire: Can a rendered Android directory contain subdirectories?

Good luck!

how to access raw folder in android,types of resources in android,android multiple resource folders,android get resource id from string,android getresources,layouts are typically defined in _________.,android studio add image to imageview,android studio resource manager,android drawable importer,android studio drawable icons,android drawable folders,convert image to drawable android,assets folder website,android read file from assets,how to access assets folder in android studio,android:drawable xml,add text in drawable xml android,android drawable icons,res/layout,android vector drawable shape,drawable-hdpi,how to use drawable resources in android,android selector drawable,drawable folder in android,android:drawable,layer-list,android:drawable list,android get drawable from resource

You May Also Like

4 Browsers that are Super Awesome

Facebook Twitter Pinterest Reddit Messenger WhatsApp Xbox One supports a wide range…

URBN Power Bank Review, Made In India Power Bank, 18W, QC 3.0 + PD

The Indian smartphone accessory brand URBN has recently launched its latest thin…

What You Need to Do If You See a Netflix VPN Error

A global pandemic changed millions of lives in a few months. Many…

How To Activate Microsoft Office 2010 Permanently 2021

How to permanently activate Microsoft Office 2010 – Who doesn’t know MS…