android - Image not shown -
image not shown here. working 2 days ago made changes , went wrong. code placed inside onpicturetaken (byte[] data , camera camera) method of jpeg callback . logcat displays onpicture taken text not first 2 texts " callback recieved null data" , "bitmap not created"
preview linear layout both height , width match parent.
the output showing blank white screen.
capture.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub capturestatus = 1 ; camera.picturecallback rawcallback = new camera.picturecallback() { @override public void onpicturetaken(byte[] data, camera camera) { // todo auto-generated method stub if (data == null) { system.out.println("callback decieved null data"); } mcamera = mpreview.stopcamera(); picture = bitmapfactory.decodebytearray(data, 0, data.length, null); matrix mat = new matrix(); mat.postrotate(90); bitmap newbitmap = bitmap.createbitmap(picture, 0, 0, picture.getwidth(), picture.getheight(), mat, true) ; pic = new imageview(c); pic.setimagebitmap(newbitmap); preview.removeallviews(); preview.addview(pic); preview.requestlayout(); system.out.println("on picture taken"); } }; try { mpreview.ycamera.takepicture(null, null,rawcallback); } catch (exception e) { e.printstacktrace(); } } });
Comments
Post a Comment