gpt4 book ai didi

android: onAutoFocus() 未在 android 4.0( Ice Cream Sandwich )虚拟设备上触发

转载 作者:太空宇宙 更新时间:2023-11-03 10:27:39 24 4
gpt4 key购买 nike

我每 3 秒自动聚焦一次,我的代码在我的硬件设备 (Galaxy S) 上运行,但在我的 AVD(虚拟设备)上,应该在聚焦完成后调用的回调永远不会被调用。有人知道为什么吗?

public void onPreviewStart(){
Log.v(TAG,"onPreviewStart() focusTimer: "+focusTimer);
if(this.autoFocus == true && getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)){
focusTimer = new Runnable() {
public void run() {
Log.d(TAG, "focus run..");
if(preview != null && preview.camera != null && !saving){
focusing = true;

Log.d(TAG, "focusing.."+preview);
// ----> this gets called each 3 seconds
preview.camera.autoFocus(new Camera.AutoFocusCallback() {

public void onAutoFocus(boolean success, Camera camera) {
// ----> this never gets called on ICS :(
Log.d(TAG, "onAutoFocus()");
focusing = false;
if(shootButtonWasPressed){ // if shooting was scheduled
Log.d(TAG, "shootButtonWasPressed");
shoot();
shootButtonWasPressed = false;
}
}
});
}
preview.postDelayed(focusTimer, 3000);
}
};
Log.v(TAG,"focusTimer run()");
focusTimer.run();
}else{
focusTimer = null;
}
}

最佳答案

您的代码似乎是正确的。问题是,在你的 AVD 上,你的相机是你的网络摄像头或类似的东西。此网络摄像头具有静态焦点,因此您的代码无法处理它...

如果您想对此进行测试,请尝试将您的手机升级到 4.0,如果您需要有关银河系的帮助,请查看此处:http://forum.xda-developers.com/forumdisplay.php?f=656

我希望你现在能看到问题所在!

最好的问候

Safari

关于android: onAutoFocus() 未在 android 4.0( Ice Cream Sandwich )虚拟设备上触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10676801/

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