Discussion Forums  >  Uncategorized

Replies: 4    Views: 480

G8torBrent
Aspiring developer
Profile
Posts: 27
Reg: Mar 04, 2011
location unknow...
270
03/20/11 08:41 PM (14 years ago)

Wrong image background on quiz in Android emulator

I mentioned this on another thread and looked around but couldn't find the answer. On the Android emulator I'm using, the quiz image (quiz_pg.png) is not being loaded into the screen as a background for the questions to go over. Instead, the app is calling the app image. I can't see in the code where that happens. I have a custom image I want to write over the quiz_pg.png, but there's no point in doing that if it's not even getting the default image in the first place. Little help. [ :-) ]
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/21/11 12:43 AM (14 years ago)
It's not doing anything it's not suppossed to. The Android version does use the App's default image in the quizzes unless you change it. There's some long and boring history behind this reasoning, those details are not important. To change the top-image that shows during a quiz, re-visit the screen_quizmultiplechoice.xml file. On around line 25, you'll see this: @drawable/app_default This is where would change the file to load another image. Add your custom image to the drawable folder, then change it to something like: @drawable/myNewImage Do not end the entry with .png, .jpg, whatever. Just use the name of the file with no extention. Hope this helps.
 
G8torBrent
Aspiring developer
Profile
Posts: 27
Reg: Mar 04, 2011
location unknow...
270
like
03/21/11 05:02 AM (14 years ago)
Actually, I was poking around the xml files last night and did this. (The quiz_pg.png file comes with the unzipped package I downloaded, so I just used that as a test, doing exactly what you said.) Even after cleaning the project and running again, it still gave me the App Image. I even looked at some of the java files to see if I could figure out the function that calls the App Image. When I was unable to do so, I posted this new thread. It was late last night when I was doing it. I'll try again this morning. Thanks.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/21/11 09:15 AM (14 years ago)
Ah... got it, makes sense. As it turns out, the setting is the xml file is over-ridden in the source code. When the screen loads, it find the 'image view' and loads the apps image. You can see where this happen by finding Screen_QuizMulitpleChoice.java in the /src folder. Look about line 139. If you comment out this line: imgBackground.setImageBitmap(quizImage); like this //imgBackground.setImageBitmap(quizImage); You're telling the source-code to ignore it, 'dont set the image' This should force it to use the image setup in the configuration / layout xml file.
 
G8torBrent
Aspiring developer
Profile
Posts: 27
Reg: Mar 04, 2011
location unknow...
270
like
03/21/11 09:22 AM (14 years ago)
You have no idea how relieved I am to read this. I had a feeling it was in the source code but don't know java well enough to figure out which function was doing what. Thanks a bunch!
 

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.