How to create a drawable from an image in assets folder?

anuj

This code always returns null

String path = "file:///android_asset/image.png";
Drawable d = null;
try {
     d = Drawable.createFromStream(ContextHolder.getActivity().getAssets().open(path), null);
} catch(Exception e) {

}
shalzangel

The path is wrong

String path = "image.png";

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Android ffmpeg : Use image for Watermark from drawable or assets folder

How to get image from assets by folder ios

How to save image from url into assets folder

Creating a Drawable from xml file in Assets folder

How to load GIF image from drawable folder into ImageView using glide?

How do I display a XAML format image from a Assets folder?

How to delete an image in assets folder from my component

Set background image not from drawable folder

How to add an image to the "drawable" folder in Android Studio?

How to get path from image on drawable folder and set as image view, Bitmap?

Flutter how to share image on assets folder?

How to create Drawable from resource

On sharing image in drawable folder

kotlin - get image from image array in drawable folder

Referencing image in assets folder

How to create a custom drawable pin with image marker

How can I dynamically load an image from my assets folder based on props in ReactJS?

How to add a typeface for ProgressDialog from assets folder?

How to view pdf from assets or raw folder?

How to copy files from 'assets' folder to sdcard?

How to Update Database from Assets Folder in App

How to Open KML file (from assets folder)

How to get images from assets folder?

unexpected behavior while loading the image from res/drawable folder

To copy an image from an sdcard into res/drawable folder of the Android app

Create ISO image from folder

How correctly retrieve an image into the res/drawable/ folder of an Android project?

How do I find the filepath to an image in the drawable folder as a string?

How to display image located in drawable folder in full screen in viewpager app?

TOP Ranking

HotTag

Archive