Domanda

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

}
È stato utile?

Soluzione

The path is wrong

String path = "image.png";

Altri suggerimenti

Drawable d = Drawable.createFromStream(getAssets().open("image.png"), null);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top