user5033346
user5033346

Reputation: 3

quiz app which is mutiple choice

I have a few activities where each one is a question and a last activity which will show the score to user. How do I do this? Can anyone teach me or give some example to use as reference?

How can I store the score for each question and then show the total score in the last activity? I don't know how to write the code for this. Can anyone teach me?

Upvotes: 0

Views: 93

Answers (1)

RajSharma
RajSharma

Reputation: 1971

You can declare any global varibale and increment it for all the correct answers.

When your quiz finished you can pass that varibale to the new activty that will show the result..

for ex--

int score; QuizActivity.java

  Intent it = new Intent(QuizActivity.this, AnswersActivity.class);
  it.putIntExtra("Score",score);
  StartActivity(it);

AnswersActivty.java

Intent it = getIntent();
int score = it.getIntExtra("Score");

I hope this will help you...

Upvotes: 1

Related Questions