English 中文(简体)
game game
原标题:outOfMemoryException in game Android
  • 时间:2010-07-19 23:10:36
  •  标签:
  • java
  • android

我一直在撰写一只roid子游戏,最后我会做所有事情,我用背井离乡的roid子和我的电话完全 fine美,但当我进入市场时,我开始收到关于其部队关闭的报告时,我的父母用他们的电话把它放开,当他们试图在屏幕菜单上点起子时,我被迫关闭。 我有他的标志,但我不相信我的父母有 st。 ......

07-18 23:58:32.457: ERROR/AndroidRuntime(25513): FATAL EXCEPTION: main
07-18 23:58:32.457: ERROR/AndroidRuntime(25513): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.Bitmap.nativeCreate(Native Method)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:346)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:372)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at com.Waldev.cannontrial.CannonBlast$panel.<init>(CannonBlast.java:136)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at com.Waldev.cannontrial.CannonBlast.onCreate(CannonBlast.java:41)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.os.Looper.loop(Looper.java:123)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at java.lang.reflect.Method.invokeNative(Native Method)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at java.lang.reflect.Method.invoke(Method.java:521)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-18 23:58:32.457: ERROR/AndroidRuntime(25513):     at dalvik.system.NativeStart.main(Native Method)
07-18 23:58:32.487: WARN/ActivityManager(85):   Force finishing activity com.Waldev.cannontrial/.CannonBlast

我不敢肯定,为什么会这样做,我认为我已经清醒地结束了游戏,但问题甚至因为我的父母甚至连开游戏。 是否有可能导致这种情况发生? 我补充说,正如“TskLaunch”和“ st”一样,这些言论中有一些内容,但似乎没有纠正这种情况。 任何想法? 而且,如果你需要其他东西来看待可能发生的事情,我将在努力解决这一问题之前,立即就此发表意见。 预 收

问题回答

这取决于你如何重装和管理你的蓝图。 (例如,你是否确保你在每条<代码>onDraw(打字)上重载轨道图?)

您还可以在装货时增加取样规模,从而减少您的记号:

Context c = myActivity; // Some activity
BitmapFactory.Options options = new BitmapFactory.Options();

// 4 here means your resulting bitmap will be 1/4 width and height => 1/16 size
options.inSampleSize = 4; // Powers of 2 are better

BitmapFactory.decodeResource(c.getResources(), R.drawable.sample_bitmap, options);




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签