Pergunta

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

}
Foi útil?

Solução

The path is wrong

String path = "image.png";

Outras dicas

Drawable d = Drawable.createFromStream(getAssets().open("image.png"), null);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top