Question: I need java coding help with an app I am creating, the part of the app I am working on is a quiz app. were

I need java coding help with an app I am creating, the part of the app I am working on is a quiz app. were I add questions then take a quiz. I have added code to add the questions, but now I need help with the code to take the quiz. true or false quiz with a next and previous button geting the questions from the list of questions the user has typed in. Help please THanks...

This is the code I have now...

import android.support.v4.app.Fragment; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.lang.reflect.Array;  public class QuizQuestionsActivity { private Button mTrueButton; private Button mFalseButton; private Button mNextButton; private Array mAnswerKey; private int mCurrentIndex; private static QuizQuestionsActivity mQuestion; public class QuizActivity extends Activity { private void updateQuestion() { int question = mAnswerKey[mCurrentIndex].getQuestion(); mQuestion.setText(question); } private void checkAnswer(boolean userPressedTrue) { boolean answerIsTrue = mQuestionBank[mCurrentIndex].isTrueQuestion(); int messageResId = 0; if (userPressedTrue == answerIsTrue) { messageResId = R.string.correct_toast; } else { messageResId = R.string.incorrect_toast; } Toast.makeText(this, messageResId, Toast.LENGTH_SHORT) .show(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.single_question); mQuestion = (TextView)findViewById(R.id.question); mTrueButton = (Button) findViewById(R.id.true_button); mTrueButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { checkAnswer(true); } }); mFalseButton = (Button)findViewById(R.id.false_button); mFalseButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { checkAnswer(false); } }); mNextButton = (Button)findViewById(R.id.next_button); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCurrentIndex = (mCurrentIndex + 1) % mAnswerKey.length; updateQuestion(); } }); updateQuestion(); } /**  @Override  public boolean onCreateOptionsMenu(Menu menu) {  getMenuInflater().inflate(R.menu.activity_quiz, menu);  return true;  }  */  } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!