I want to make image/picture as background but using android:background="#ffff"
makes it white and it works. As soon as I change to android:background="@drawable/background_image"
and run it, crash.
Asked
Active
Viewed 130 times
-2

Lukas Šliužas
- 57
- 1
- 9
-
is background_image available in your draw able folder? – Mehul Patel Aug 21 '18 at 11:50
-
Yes it is placed there – Lukas Šliužas Aug 21 '18 at 11:53
-
Where did you set Image Background? – Rahul Chokshi Aug 21 '18 at 11:53
-
No Vladyslav, if I go back to #ffff it works. Nothing crashes – Lukas Šliužas Aug 21 '18 at 11:53
-
– Lukas Šliužas Aug 21 '18 at 11:53
-
2`Nothing crashes` - you just said that it is crashing in your title. The question I marked explains what your question is missing to be on-topic. As for now it is off-topic because it is missing exception stacktrace, related code, etc. – Vladyslav Matviienko Aug 21 '18 at 11:55
-
"As soon as I change to android:background="@drawable/background_image" and run it, crash." – Lukas Šliužas Aug 21 '18 at 11:56
-
1Look at [the stack trace](http://stackoverflow.com/questions/23353173) to determine the cause of the crash. – Mike M. Aug 21 '18 at 11:58
-
1[https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this][1] This helped to fix it – Lukas Šliužas Aug 21 '18 at 13:06
2 Answers
1
try it with another image.
sometime when you have Image in Png extintion then change it to jpg extenction you need to invalidate/restart the android stdiuo

Mohammad Rbabah
- 456
- 2
- 10
0
Maybe your image is too big and it has high resolution, try compressing and resizing it http://resizeimage.net/ using this website and put the compressed image as background if that doesn't work also try to put the image in xhdpi or xxhdpi folder

Badran
- 515
- 1
- 7
- 21