Reputation: 641
I am developing an android Custom Camera app without using the built-in intent. And I am using the Below code for Surface change
public void surfaceChanged(SurfaceHolder sHolder, int format, int width, int height)
{
if (isPreview)
{
try
{
camera.stopPreview();
isPreview = false;
}
catch (Exception e)
{
Log.e(TAG, "surfaceChanged", e);
}
}
try
{
Camera.Parameters p = camera.getParameters();
p.setPreviewSize(surface.getWidth(), surface.getHeight());
camera.setParameters(p);
}
catch (Exception e)
{
Log.e(TAG, "surfaceChanged", e);
}
try
{
camera.setPreviewDisplay(holder);
}
catch (IOException e)
{
e.printStackTrace();
}
camera.startPreview();
isPreview = true;
}
But After using the above code in my custom camera app, The image resolution is very low compared to built-in camera app though I am not setting any resolution explicitly in my code. Not getting where I am going wrong! Please Help! Thanks!
Upvotes: 1
Views: 1402
Reputation: 1923
Use getSupportedPictureSizes()
on Camera.Parameters
to find the size you want, or use that information to populate a ListView or Spinner
Check this out ...it will surely help you
Upvotes: 2