Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App closes when dabatase question overs . Help #13

Open
anshul0430 opened this issue Jun 18, 2018 · 2 comments
Open

App closes when dabatase question overs . Help #13

anshul0430 opened this issue Jun 18, 2018 · 2 comments

Comments

@anshul0430
Copy link

if (c2 == 0) {
for (i = 1; i < 50; i++) {
list.add(new Integer(i));

            }

            Collections.shuffle(list);

            c2=1;
        }
        Ques = Sports.readQuestion(list.get(j));
        Opta = Sports.readOptionA(list.get(j));
        Optb = Sports.readOptionB(list.get(j));
        Optc = Sports.readOptionC(list.get(j));
        Optd = Sports.readOptionD(list.get(j));
        global = Sports.readAnswer(list.get(j++));

    } 

If my database question are over then the app crashes.

@SourabhMane
Copy link

To avoid this error you need to check the value of J counter, if J counter value is equal to nos of questions in list then create an intent and call Result activity to display result and in else part continue with the reading of questions and answer.

The above solution worked for me.

if (j == 50 )
{
call Result activity
}
else
{
Ques = Sports.readQuestion(list.get(j));
Opta = Sports.readOptionA(list.get(j));
Optb = Sports.readOptionB(list.get(j));
Optc = Sports.readOptionC(list.get(j));
Optd = Sports.readOptionD(list.get(j));
global = Sports.readAnswer(list.get(j++));
}

@78Ronin78
Copy link

To avoid this error you need to check the value of J counter, if J counter value is equal to nos of questions in list then create an intent and call Result activity to display result and in else part continue with the reading of questions and answer.

The above solution worked for me.

if (j == 50 )
{
call Result activity
}
else
{
Ques = Sports.readQuestion(list.get(j));
Opta = Sports.readOptionA(list.get(j));
Optb = Sports.readOptionB(list.get(j));
Optc = Sports.readOptionC(list.get(j));
Optd = Sports.readOptionD(list.get(j));
global = Sports.readAnswer(list.get(j++));
}

Thanks, this work it me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants