Question

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

}
Était-ce utile?

La solution

The path is wrong

String path = "image.png";

Autres conseils

Drawable d = Drawable.createFromStream(getAssets().open("image.png"), null);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top