gpt4 book ai didi

android - 拍照后返回按钮不起作用

转载 作者:行者123 更新时间:2023-11-30 01:53:45 25 4
gpt4 key购买 nike

我正在尝试实现我找到的解决方案 HERE但是在我点击捕获之后,后退按钮没有完成 Activity 。有没有办法调用

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();
}

最佳答案

好的,不要做 finish(); 尝试对所需的 activity 进行 Intent :

@Override
public void onBackPressed() {
super.onBackPressed();
startActivity(new Intent(YourActivity, DesiredActivity));
finish();
}

关于android - 拍照后返回按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32592051/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com