문제

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