Android - load image from path -
in project have image localized in
app\src\main\res\drawable\informations\angry_face.png
when want load using
bitmap bitmap = bitmapfactory.decodefile("app\\src\\main\\res\\drawable\\informations\\angry_face.png"); this.image.setimagebitmap(bitmap);
error occurs:
unable decode stream: java.io.filenotfoundexception: app\src\main\res\drawable\informations\angry_face.png: open failed: enoent (no such file or directory)
question is: how set path resource?
thanks :)
you accessing resources wrongly:
try instead:
bitmap myangryimage = bitmapfactory.decoderesource(getresources(), r.drawable.angry_face);
Comments
Post a Comment