App stürzt ab wen man Layout hintergrund ändern will

  • Antworten:2
  • OffenNicht stickyNicht beantwortet
  • Forum-Beiträge: 3

24.04.2016, 13:26:46 via Website

Hallo, ich hätte mal eine frage

Ich will den Layout Hintergrund durch ein Bild ersetzten doch wen ich es versuche
Stürzt meine App ab,

Danke in voraus freue mich auf jede Antwort

Fehlermeldung (nur das fettgedruckte )

04-21 16:43:29.142 4973-4973/com.example.babo.myapplication E/dalvikvm-heap: 2446912-byte external allocation too large for this process.
04-21 16:43:29.142 4973-4973/com.example.babo.myapplication E/GraphicsJNI: VM won't let us allocate 2446912 bytes

04-21 16:43:29.162 4973-4973/com.example.babo.myapplication D/dalvikvm: GC_FOR_MALLOC freed 3K, 46% free 3076K/5639K, external 24805K/25227K, paused 20ms
04-21 16:43:29.162 4973-4973/com.example.babo.myapplication D/AndroidRuntime: Shutting down VM
04-21 16:43:29.162 4973-4973/com.example.babo.myapplication W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
04-21 16:43:29.172 4973-4973/com.example.babo.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:532)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:507)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:370)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
at android.content.res.Resources.loadDrawable(Resources.java:1720)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.(View.java:1975)
at android.widget.ImageView.(ImageView.java:116)
at android.widget.ImageButton.(ImageButton.java:85)
at android.support.v7.widget.AppCompatImageButton.(AppCompatImageButton.java:57)
at android.support.v7.widget.AppCompatImageButton.(AppCompatImageButton.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:118)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1031)
at android.support.v4.view.LayoutInflaterCompatBase$FactoryWrapper.onCreateView(LayoutInflaterCompatBase.java:36)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.babo.myapplication.Main2Activity.onCreate(Main2Activity.java:28)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
at android.app.ActivityThread.access$1500(ActivityThread.java:121)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)

Antworten
Pascal P.
  • Mod
  • Blogger
  • Forum-Beiträge: 10.177

24.04.2016, 13:28:21 via Website

Dein Bild ist zu groß, sagt ja schon der OutOfMemory Error.
Wie sieht denn dein Code aus und wie groß ist das Bild( Pixel und Dateigröße)

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten
  • Forum-Beiträge: 3

24.04.2016, 14:14:33 via Website

Jo, es war zu groß über 1000x1000 (laughing)
Aber warum klappt es beim erster Layout und beim zweiten nicht(neue activity)?

— geändert am 25.04.2016, 13:06:23

Antworten

Empfohlene Artikel