Multiple XML files

Put your problem here if it does not fit any of the other categories.

Multiple XML files

Postby ef em el » Fri Jan 07, 2011 8:40 pm

Hey all,

I've been working on a trivia game that will apparently be breaking the 1,000 questions mark, and originally started out by creating an XML file for each question. All it is is the background with question written on it and then the answer buttons, but now i'm realizing it would end up being 1,000 xml files total and was wondering if theres a different way I should go about this? Will this be a major issue? Am I overlooking an easy answer to doing so many questions?
ef em el
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Dec 22, 2010 9:16 am

Top

Re: Multiple XML files

Postby jonbonazza » Fri Jan 07, 2011 9:58 pm

why not just make 1 XML with all of the questions?
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Re: Multiple XML files

Postby Jems » Sat Jan 08, 2011 12:57 am

Just use a single xml file, and a String array for the question ( or more for the answers too). You can then set your activity's content to that xml file, and dynamically change the question/answers by loading from the array. You can make String arrays as part of a standard android values xml file, but storing them directly as data files might be smaller.
Jems
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Thu Dec 09, 2010 7:42 pm

Re: Multiple XML files

Postby ef em el » Sat Jan 08, 2011 10:55 am

I use a funky font and all 4 of my answer buttons are custom as well, and question placement varies based on type of question. 1 XML file rotating 5 PNGs a little better than separate xml files or do I need to incorporate my goofy font and come up with a way to write each question/answer where I need them per question manually? I realize this might be an obvious and stupid question, but with 1 XML file I could keep the A B C D the same and just rotate answer text (which I also want clickable) just by setting 5 drawables to the new question.
ef em el
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Dec 22, 2010 9:16 am

Re: Multiple XML files

Postby jonbonazza » Sun Jan 09, 2011 5:17 am

have 2 attributes for each question node in your XML for location (one for x and one for y). When you parse the xml, look for the particular attribute and adjust position accordingly.
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 20 guests