I have recently modified my Camera to capture and display full-size images,the size on the Galaxy Nexus is 2592 X 1944.I have tried using an LruCache when capturing the image and displaying it in the preview.Where the image should have been there is white space.A previous entry on my LogCat tells me that the image has been saved.
How can I get the full size image to display?
The picture size is obtained using:
private Size getDesiredPictureSize(Parameters params)
{
//Resolution is widthxheight
Size result=null;
//boolean isDesiredValue=false;
final int minArea=500*500;
final int maxArea=1000*1000;
List<Size> supportedSizeList=params.getSupportedPictureSizes();
for(Size size:supportedSizeList)
{
if(result==null)
result=size;
else
{
int resultArea=result.width*result.height;
int sizeArea=size.width*size.height;
if(resultArea<sizeArea)
{
result=size;
Log.d("CameraPreview", "Result pictureSize has been set to "+result.width+"X"+result.height);
}
}
}
Log.d("CameraPreview", "Picture size has been set to "+result.width+"X"+result.height);
return result;
}
The logcat displays the following when the Image must displayed for Preview:
FATAL EXCEPTION: main
java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCopy(Native Method)
at android.graphics.Bitmap.copy(Bitmap.java:450)
at com.example.newscancardapp.ImagePreviewActivity.onCreate(ImagePreviewActivity.java:58)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)