Android Converting to bitmap crash -
Android Converting to bitmap crash -
ok supposed create android application reason, cannot convert image bitmap image. it's .png image , when seek convert in code, application crashes, no errorcode or nothing. ive tried fixing ton of times, i'm not in programming , need help, won't work.
protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == foto_nemen && resultcode == result_ok) { final file file = temp; seek { string urienzo = "file:///sdcard/dcim/2013-01-30_13-27-28.png"; uri uri = uri.parse(urienzo); bitmap foto = mediastore.images.media.getbitmap(this.getcontentresolver(), uri); if (foto == null) { toast.maketext(this, uri.fromfile(file).tostring(), toast.length_short).show(); return; } bytearrayoutputstream bos = new bytearrayoutputstream(); foto.compress(bitmap.compressformat.png, 0 , bos); final byte[] bytes = bos.tobytearray(); bos.close(); asynctask<void,void,void> taak = new asynctask<void,void,void>() { @override protected void doinbackground(void... params) { stuurafbeelding(bytes); homecoming null; } }; taak.execute(null,null); } grab (ioexception e) { log.e("snapper","fout bij foto nemen: " + e); } } }
whenever bitmap foto part, crashes application without error message. reason uri hardcoded because think uri.fromfile giving me wrong uri, wanted sure. crashes , have no thought wrong code. aid me?
i imagine it's crashing because that's not how load image file.
the code much simpler you're trying:
bitmap bmp = bitmapfactory.decodefile(urienzo);
and that's all! sure path correct, because doesn't right me.
also, if you're loading big image (e.g. 4mp)it crash out of memory, because thought of bitmaps utilize set stuff on screen around hd fullhd resolutions.
android bitmap crash uri
Comments
Post a Comment