【发布时间】:2015-09-15 17:21:10
【问题描述】:
我正在尝试实施我找到的解决方案 HERE 但是在我点击捕获后,后退按钮没有完成活动。有没有办法调用
finish();
在函数内按下后退按钮时
private void capture() {
mCamera.takePicture(null, null, null, new Camera.PictureCallback() {
final float bearing = degree;
@Override
public void onPictureTaken(byte[] data, Camera camera) {
latitude = mGpsLocationTracker.getLatitude();
longitude = mGpsLocationTracker.getLongitude();
Toast.makeText(getApplicationContext(), "Picture Taken",
Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "" +
latitude + ", " + longitude, Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "" + bearing, Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("image_arr", data);
setResult(RESULT_OK, intent);
camera.stopPreview();
if (camera != null) {
camera.release();
mCamera = null;
}
finish();
}
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
【问题讨论】:
-
捕获后显示什么应用??
-
它只是在视图中显示捕获的图像
-
你是否尝试过覆盖 backbuttonPressed 方法??
-
我在函数之外覆盖了那个函数。我编辑了问题以包含该代码