开发者

not finishing activity when passing picture of byte array taken by camera

开发者 https://www.devze.com 2023-02-14 06:59 出处:网络
i am using a main activity which is calling a cameraActivity and using picture taken by camera. i am finish camera activity on pictureTaken and passing byte array to parent activity

i am using a main activity which is calling a cameraActivity and using picture taken by camera. i am finish camera activity on pictureTaken and passing byte array to parent activity

  protected PictureCallback jpegCallback=new PictureCallback() {
    public void onPictureTaken(byte[] data, Camera camera) {

               //Finishing Camera activity              
           Bundle bundle=new Bundle();
       bundle.putByteArray("imageToPreview", data);
       mPreview.imageBundle=bundle;
               Intent it=new Intent;
               it.putExtras(bundle);
               CameraActivity.this.setResult(Activity.RESULT_OK,it);
       CameraActivity.this.finish();

        } 

      }
    };

so passing image byte array creating problem and result in not f开发者_如何学Pythoninish of activity.

if i pass simply

CameraActivity.this.setResult(Activity.RESULT_OK);
CameraActivity.this.finish();

it working properly plz help i have to use this image in parent activity


i got the solution of my problem actually we should not pass large amount of data through intent as mentioned here


Hey sunil, same problem appeared wen i tried to work on image processing. i was extracting image's pixels in bytearray and performing activity on array. The problem was it was takin time to extract all bytes and so my program was becoming a big fussss. But then i found in api that there were functions to stop performing next activity untill extraction is completed. also i was able to set max allowable time for extraction. check out in ur api such supportive methods and fields.

0

精彩评论

暂无评论...
验证码 换一张
取 消