Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 19    Views: 219

Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
04/07/13 07:21 PM (12 years ago)

Android Background images not displaying with menu with image

(I did post this elsewhere in the forums, but couldn't find it, so I'm reposting it here!) OK, I've spent ages trying to figure this one out. I've check GNWests documents, I've poked and prodded, but they refuse to show! File name is woodenwalkway1.png JSON: "backgroundImageNameSmallDevice":"woodenwalkway1.png", "backgroundImageNameLargeDevice":"woodenwalkway1.png", "backgroundImageScale":"fullScreen", "includeAds":"0" File is in the Eclipse project (in res/drawable). LOGCAT doesn't seem to indicate "wooden" even exists, I scanned it but it doesn't show up. I'm using the most recent Menu with Image plugin, and recently (yesterday) downloaded source code. Any thoughts?
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/07/13 08:01 PM (12 years ago)
That's how I thought it should work! Could it just be a bad image? Have you tried other images? Or tried to save it or export it again as a .png? What size is the image? And what do you mean by "scanned it"? Do you mean you refreshed the directory? Certainly a weird problem!
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/07/13 08:13 PM (12 years ago)
It's 640 × 1136 pixels, it was a jpg, so I exported it to a png to try that. It works fine in iOS. Scanned - I searched LOGCAT but couldn't find a reference to the filename. I have checked the BTConfig and it is in there!
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/07/13 08:28 PM (12 years ago)
Ok, if it's in res/drawable you would assume Android would scale it up or down depending on the device. How many rows in the menu? Is there clear space at the bottom of the rows? Could your rows be hiding the background? What is the row background color? Does a simple color background work? Just some things to try ... cheers
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
04/08/13 05:24 AM (12 years ago)
As ictguy says, everything looks ok. You could try hardcoding the image directly into the project. Not sure what it'll prove but if it still doesn't show it would almost certainly be a problem with the image. Also, in your control panel temporarily make 'Row Background Color' "clear" (without the quotes). The background image should then definitely show if the image is ok. In screen_wb_menuimage.xml 3rd line down in the RelativeLayout replace: android:background="@android:color/transparent" with android:background="@drawable/woodenwalkway1"
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/08/13 06:36 AM (12 years ago)
Hmm. Eclipse gives me a 'No resource found that matches the given name' error. I tried it with a tab icon that works, but it gives me the same error. I attached a screenshot too... http://bit.ly/10L6JOa If it helps or hinders, the header image doesn't show up either...
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/08/13 06:50 AM (12 years ago)
That helps a bit ... I don't think you need the .png on the end as android assumes an image file type for background. Did you try the 'clear' option in the table rows and other suggestions on the table?
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/08/13 06:52 AM (12 years ago)
yes, I tried it with and without the .png, I also tried the clear options.
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/08/13 06:57 AM (12 years ago)
The only thing I can think of is that the image is not supported by Android (color space perhaps, bit value of the image eg 8bit vs 16 bit) I'd definitely try some other images png & jpg and see what shakes out ... wish I could offer some other suggestions :(
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
04/08/13 07:08 AM (12 years ago)
You have the path wrong - you have: android:background="@android:drawable/woodenwalkway1.png" it should be: android:background="@drawable/woodenwalkway1"
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/08/13 07:17 AM (12 years ago)
Well done @raveyd I missed that!
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
04/08/13 07:22 AM (12 years ago)
@ictguy, It's easy to spot after making the same mistakes so many times in my own projects!
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/08/13 07:26 AM (12 years ago)
Agreed, sometimes you can get too close and can't see the forest from the trees!
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/08/13 07:36 AM (12 years ago)
OK, even stranger... I put the pic onto Dropbox, switched it to an URL and it worked. Switched it back, and it worked still... (without editing the source) I don't really have an answer, but I'll add the next screen and see what happens. Thank you for your time and efforts, it's appreciated.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
04/08/13 07:44 AM (12 years ago)
Maybe a caching issue? When I work in control panels online I often log out, clear the browser cache and log in again. Had to do it years ago with a php script and I guess the habit stuck. It'll often clear up niggly problems. In eclipse also regularly do a Project > Clean to keep things tidy, it's a temperamental platform.
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/08/13 08:23 AM (12 years ago)
OK, since you guys are/were here... is there a rule I can apply when it comes to the sizing/resolution of images? I can get each one to show, but if I try to cycle between the tabs, eventually it will crash with a VM allocation error. I've already moved images down to 420k and that's scraping the bottom of the barrel quality wise. Image is a png, 679x1024, 256 color, size is 420k 04-08 11:17:59.655: W/ZZ(340): WB_screen_menuImage:backgroundWorkerThread using image from project bundle: "earth.jpg" 04-08 11:17:59.665: E/dalvikvm-heap(340): 3130368-byte external allocation too large for this process. 04-08 11:17:59.665: W/ZZ(340): BT_fileManager:deleteFile 779911E09BF4E6BDAF05602_screenData.txt 04-08 11:17:59.675: E/GraphicsJNI(340): VM won't let us allocate 3130368 bytes 04-08 11:17:59.685: W/dalvikvm(340): threadid=8: thread exiting with uncaught exception (group=0x4001d800) 04-08 11:17:59.705: E/AndroidRuntime(340): FATAL EXCEPTION: Thread-15 04-08 11:17:59.705: E/AndroidRuntime(340): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
04/08/13 08:28 AM (12 years ago)
What image editor are you using? Try exporting as png8, 128 colors, alpha transparency. I don't know how your saving pngs, are you retaining the layers? Exporting should flatten the layers into a bitmap png, much smaller file size.
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/08/13 08:48 AM (12 years ago)
Preview and Photoshop. It's not that it doesn't work, it displays, I change tab, that displays, I change back and then it falls over. It acts like it can only hold so much and it accumulates and then fails. I was hoping to be able to keep it as 1 project for iOS and Android, but it isn't looking too hopeful at the moment, not at the cost of resolution/clarity as I expect Apple will reject it because they aren't high enough res :)
 
Fingers Crossed
Veteran developer
Profile
Posts: 234
Reg: Jan 16, 2012
Simcoe, ON
6,390
like
04/08/13 08:49 AM (12 years ago)
(That said, I'll keep the names the same, and drop the res as much as I can and put them in the res folder to see what happens!)
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
04/08/13 09:03 AM (12 years ago)
It's almost certainly the file sizes. I've had identical errors cycling through the tabs until I reduced the file sizes right down. After a lot of trial and error trying to keep images under 200/250kb seems to work for me. The thing is, android should easily handle larger sizes, it's as if something isn't quite right either in the tabs or menu plugin.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.