Reputation: 9237
As you can see the camera view on my emulator is stretched and I don't know how this came about (it was fine beforehand), is it one of the camera parameters I am missing? or is it some other issue ?
Code:
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
if (previewRunning) {
camera.stopPreview();
}
Camera.Parameters p = camera.getParameters();
camera.setParameters(p);
try {
camera.setPreviewDisplay(holder);
} catch (IOException e) {
e.printStackTrace();
}
camera.startPreview();
previewRunning = true;
}
Upvotes: 0
Views: 845
Reputation: 757
Its All because of the camera orientation:
Set: camera.setDisplayOrientation(90);
For More Details See Here: http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation(int)
Upvotes: 2
Reputation: 30
I had the same issue, though I had fullscreen, so my image was even more stretched. Pretty much it's just rotated by 90 degrees. When you are setting preferences for preview, see what you are setting. In my case I had portrait settings for the activity, and changing it to landscape fixed it. My guess is that you're just mixing height and width of the preview. Also, if you look at Google Sample API, you can find sample how to get proper sizes for the screen. Hope that helps - I had trouble with that issue and it looked horrible on the actual device.
Upvotes: 0