Вопрос

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

}
Это было полезно?

Решение

The path is wrong

String path = "image.png";

Другие советы

Drawable d = Drawable.createFromStream(getAssets().open("image.png"), null);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top