Frage

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

}
War es hilfreich?

Lösung

The path is wrong

String path = "image.png";

Andere Tipps

Drawable d = Drawable.createFromStream(getAssets().open("image.png"), null);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top