java - ANDROID STUDIO: Take picture with Camera API -> Send this picture to another activity -
after take picture camera api, picture displays on screen/this activity. want send picture covers whole screen activity called pictureeditor. there add functionality can edit picture.
// code in mainactivity mcamera.takepicture(null, null, mpicture); intent = new intent(getapplicationcontext(), pictureeditor.class); bitmap b = getbitmapfromview(mpreview); bytearrayoutputstream bs = new bytearrayoutputstream(); b.compress(bitmap.compressformat.png, 50, bs); i.putextra("bytearray", bs.tobytearray()); startactivity(i);
in pictureeditor have code in oncreate.
// code in pictureeditor if(getintent().hasextra("bytearray")) { imageview previewthumbnail = new imageview(this); bitmap b = bitmapfactory.decodebytearray( getintent().getbytearrayextra("bytearray"),0,getintent().getbytearrayextra("bytearray").length); previewthumbnail.setimagebitmap(b); }
what can retrive picture in pictureeditor, , picture thing visible on screen in activity? (decode bitmap , display image on screen)
thanks kind of help!
instead of startactivity
call startactivityforresult
, image bundle in onactivityresult
call method in same activity , pass image new activity
.
Comments
Post a Comment