Discussion Forums  >  Uncategorized

Replies: 2    Views: 432

Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
07/03/11 04:25 PM (14 years ago)

Android Quiz Bug

I have a quiz with 103 questions in the pool and the quiz is 10 questions long. When I reach the end of the quiz and hit 'try again' or 'refresh questions', the new quiz score starts from the last quiz score, usually about 3600 because I wrote all the Q&A's :-) The only way to start again at 0 points is to navigate back to the start quiz button on the home page. In addition, I've started getting this stack trace error report in my android dashboard - it's connected to the quiz, could the two things be related? java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) at java.util.ArrayList.get(ArrayList.java:311) at com.v1_4.BE804BC202C8791598FF54B6.com.Screen_QuizMultipleChoice.answerClick(Screen_QuizMultipleChoice.java:312) at com.v1_4.BE804BC202C8791598FF54B6.com.Screen_QuizMultipleChoice$10.onClick(Screen_QuizMultipleChoice.java:170) at android.view.View.performClick(View.java:2408) at android.view.View$PerformClick.run(View.java:8817) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:143) at android.app.ActivityThread.main(ActivityThread.java:4914) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) at dalvik.system.NativeStart.main(Native Method) On an unrelated issue, I needed to create a lot of screens (114). In my dashboard, up to 100 screens all sorted nicely into A to Z alphabetical order. When the screens reached 100, they started sorting from A to Z again.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
07/04/11 09:34 AM (14 years ago)
Ignore the last bit... I blame sunstroke...
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/04/11 09:05 PM (14 years ago)
Lets start by getting the score to re-set. Try this: /src/Screen_QuizMultipleChoice.java file in the Eclipse project. Scroll to the startQuiz method around line 398. You'll see where lots of variables are set to zero when the quiz starts. It doesn't look like the totalScore variable is being reset here. Go ahead and add a totalScore = 0; line in that list of other variables being set to zero. This should fix score not resetting issue. Re-post your findings and we'll see if it also magically fixed the other issues.
 

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.