我拍照通过我的设备我的应用程序,并使用三星注2如何在android中处理java.lang.OutOfMemoryError错误?
保存该到服务器
IM,但我发现这个错误
10-31 20:34:06.759: E/AndroidRuntime(12985): FATAL EXCEPTION: Thread-5431
10-31 20:34:06.759: E/AndroidRuntime(12985): java.lang.OutOfMemoryError
10-31 20:34:06.759: E/AndroidRuntime(12985): at android.graphics.Bitmap.nativeCreate(Native Method)
10-31 20:34:06.759: E/AndroidRuntime(12985): at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
10-31 20:34:06.759: E/AndroidRuntime(12985): at android.graphics.Bitmap.createBitmap(Bitmap.java:586)
10-31 20:34:06.759: E/AndroidRuntime(12985): at com.winit.dropbox.MainScreen.flip(MainScreen.java:1241)
10-31 20:34:06.759: E/AndroidRuntime(12985): at com.winit.dropbox.MainScreen$DropBoxUploader.run(MainScreen.java:1166)
10-31 20:34:06.759: E/AndroidRuntime(12985): at java.lang.Thread.run(Thread.java:856)
码点这条线,
Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false);
而m是
Matrix m = new Matrix();
编辑:我已经删除了矩阵中创建位图现在,但我现在面临的问题,同时调整通过Android设备拍摄的图像,使用
bmp = BitmapsUtiles.getResizedBmp(bmp, AppConstants.DEVICE_WIDTH, AppConstants.DEVICE_HEIGHT);
IM但仍不能正常工作,你能指出什么我做错了,而调整大小?
请看看开发者网站:http://developer.android.com/training/displaying-bitmaps/load-bitmap.html –
你怎么知道那是只有2MB?宽度*高度* 4 = 2MB? – Selvin
我已经检查了以前文章中已经提到的所有链接 – Ari