我通过拍照并将其数据传递给活动来开始一项新活动。由于某种原因,活动没有开始。(或者可能需要很多时间)像这样:
cameraResult = new Intent(Activity.this, ResultActivity.class);
final Camera.PictureCallback cameraSavePictureCallback = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
// TODO Auto-generated method stub
cameraResult.putExtra("PictureData", data);
cameraResult.putExtra("size", "10cm");
startActivity(cameraResult);
}
};
final ShutterCallback myShutterCallback = new ShutterCallback() {
@Override
public void onShutter() {
// TODO Auto-generated method stub
}
};
final Camera.PictureCallback myPictureCallback_RAW = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] arg0, Camera arg1) {
// TODO Auto-generated method stub
}
};
// Add a listener to the Capture button
Button captureButton = (Button) findViewById(id.button_capture);
captureButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// get an image from the camera
camera.takePicture(myShutterCallback, myPictureCallback_RAW, cameraSavePictureCallback);
}
});
我在新活动中有一个断点,它没有得到他们的,所以问题不在于活动。
有人可以告诉我可能出了什么问题,这是否是在新屏幕上显示图片的正确方法?
EDIT1: 我忘了提到只有当我拍一张根本不是黑色的照片时才会发生这种情况。我的意思是,如果我盖上镜头并拍照,它不会卡住
EDIT2:我在 logcat 中有错误
04-13 14:09:34.777: ERROR/JavaBinder(13009): !!! FAILED BINDER TRANSACTION !!!