pietjuhhh1990
Well-Known Member
I am still a bit new to android.
I've used C# and a lot of web based coding languages.
I'm making an app in witch the autofocus must work. The problem is that the autofocus function is pretty bad if the distance is short. Since there is no manual way of setting this I want to make the autofocus functon loop 5 times to try and get the right focus and quit when the focus is good.
this are the 2 peaces of code for the camera:
When the camera is focused is shoud automaticly return true. I've manually changed the value of succes to true in the onAutoFocus in the hope it would work.
I hope someone could help
Thanx in advance
I've used C# and a lot of web based coding languages.
I'm making an app in witch the autofocus must work. The problem is that the autofocus function is pretty bad if the distance is short. Since there is no manual way of setting this I want to make the autofocus functon loop 5 times to try and get the right focus and quit when the focus is good.
this are the 2 peaces of code for the camera:
Code:
success = false;
int iLoop = 5;
//loop autofocus for positive focus
while (iLoop >= 0 && success == false)
{
iLoop--;
mCamera.autoFocus(myAutoFocusCallback);
try {
//give camera time 2 focus
Thread.sleep(1500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
}
}
Code:
AutoFocusCallback myAutoFocusCallback = new AutoFocusCallback(){
public void onAutoFocus(boolean success, Camera mCamera) {
success = true;
return;
}
};
I hope someone could help
Thanx in advance
