DNPereira Posted February 13, 2013 at 03:30 PM Report #495134 Posted February 13, 2013 at 03:30 PM (edited) try { open1 = manager.open(LayoutOne.Info.get(LayoutOne.e)+File.separator+LayoutTwo.theme.get(LayoutTwo.r)+File.separator+"Background.jpg"); bMap = BitmapFactory.decodeStream(open1).copy(Bitmap.Config.ARGB_8888, true); BackGround.setImageBitmap(null); BackGround.setImageBitmap(bMap); } catch (IOException e1) { e.printStackTrace(); } Erro E/AndroidRuntime(5929): FATAL EXCEPTION: main E/AndroidRuntime(5929): java.lang.OutOfMemoryError E/AndroidRuntime(5929): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) E/AndroidRuntime(5929): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:574) E/AndroidRuntime(5929): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:640) E/AndroidRuntime(5929): at com.LayoutThree.onCreate(LayoutThree.java:155) não estou a conseguir resolver. porque quando tento colocar novas imagens nos bitmaps ele não deixa e dá esse erro de memoria obrigado Edited February 13, 2013 at 03:33 PM by DNPereira
KTachyon Posted February 13, 2013 at 11:31 PM Report #495201 Posted February 13, 2013 at 11:31 PM A imagem que estás a carregar tem que dimensões? Seria um dado útil para o problema. De qualquer forma, acredito que seja uma imagem de grandes dimensões. Quando o bitmap é criado, vais estar a ocupar 4 bytes por pixel (3 cores + alpha), o que no caso de uma imagem de 8 MP dá qualquer coisa como 32 MB. Aconselho a leitura dos tópicos apresentados na seguinte página: http://developer.android.com/training/displaying-bitmaps/index.html 1 Report “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now