0
可能重複:
java.lang.OutOfMemoryError: bitmap size exceeds VM budget位圖大小爲背景圖片的問題
嗨frineds 我把背景圖像進行佈局android系統中,而把bacground並給予fillparent佈局。我得到以下例外可以告訴如何避免這種情況
04-11 21:47:36.435: ERROR/AndroidRuntime(316): FATAL EXCEPTION: main
04-11 21:47:36.435: ERROR/AndroidRuntime(316): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gcm/com.gcm.MyProfileActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class android.widget.TableLayout
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.os.Looper.loop(Looper.java:123)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at java.lang.reflect.Method.invoke(Method.java:521)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at dalvik.system.NativeStart.main(Native Method)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class android.widget.TableLayout
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.Activity.setContentView(Activity.java:1647)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at com.gcm.MyProfileActivity.onCreate(MyProfileActivity.java:12)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): ... 11 more
04-11 21:47:36.435: ERROR/AndroidRuntime(316): Caused by: java.lang.reflect.InvocationTargetException
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.widget.TableLayout.<init>(TableLayout.java:102)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at java.lang.reflect.Constructor.constructNative(Native Method)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): ... 22 more
04-11 21:47:36.435: ERROR/AndroidRuntime(316): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.Bitmap.nativeCreate(Native Method)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.content.res.Resources.loadDrawable(Resources.java:1709)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.View.<init>(View.java:1885)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.View.<init>(View.java:1834)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.view.ViewGroup.<init>(ViewGroup.java:285)
04-11 21:47:36.435: ERROR/AndroidRuntime(316): at android.widget.LinearLayout.<init>(LinearLayout.java:115)