android 应用中的问题在洗牌时重复出现

Questions in android app gets repeated when shuffling them

我是整个编码世界的新手。我目前正在为孩子们创建一个学习应用程序,其中一个类别是参加测验。我想打乱所有的问题并且我能够这样做但是我现在面临的问题是问题被重复

这是我用于测验问题的代码activity

public class QuizQuestions extends AppCompatActivity {

    Button back;
    Toolbar toolbar;
    TextView toolText;
    private ImageView img;
    private TextView mScoreView;
    private TextView mQuestionView;
    private TextView mButtonChoice1;
    private TextView mButtonChoice2;
    private TextView mButtonChoice3;
    private TextView mButtonChoice4;
    private String mAnswer;
    private int mScore = 0;
    private int mQuestionNumber = 0;
    private Button nextQues;
    private ImageView dialogImg;
    private TextView dialogText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_quiz_questions);

        //Assign action bar
        toolbar = findViewById(R.id.toolbar3);
        setSupportActionBar(toolbar);
        //assign TextView in Toolbar
        toolText = findViewById(R.id.toolbar3_text);
        //setText of TextView in Toolbar
        toolText.setText("Quiz");

        //Assign back button
        back = findViewById(R.id.back);

        //setOnClickListener for back btn
        back.setOnClickListener(new View.OnClickListener() {
            //onClick for back button
            @Override
            public void onClick(View v) {
                Intent mainIntent = new Intent(QuizQuestions.this, MainActivity.class);
                startActivity(mainIntent);
            }//end of onClick
        });//end of setOnClickListener

        mScoreView = (TextView) findViewById(R.id.score);
        mQuestionView = (TextView) findViewById(R.id.quiz_question);
        mButtonChoice1 = (TextView) findViewById(R.id.option_one);
        mButtonChoice2 = (TextView) findViewById(R.id.option_two);
        mButtonChoice3 = (TextView) findViewById(R.id.option_three);
        mButtonChoice4 = (TextView) findViewById(R.id.option_four);
        img = (ImageView) findViewById(R.id.quiz_img);

        updateQuestion();


        mButtonChoice1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mButtonChoice1.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice1.getText() == mAnswer) {

                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        mButtonChoice2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (mButtonChoice2.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }

                if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice2.getText() == mAnswer) {

                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        mButtonChoice3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (mButtonChoice3.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }
                if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice3.getText() == mAnswer) {
                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        mButtonChoice4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mButtonChoice4.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }
                if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice4.getText() == mAnswer) {

                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        }



    private void updateQuestion(){
        shuffleQuestions();
        mQuestionView.setText(questionArray[mQuestionNumber].getQuestion());
        mButtonChoice1.setText(questionArray[mQuestionNumber].getOptionOne());
        mButtonChoice2.setText(questionArray[mQuestionNumber].getOptionTwo());
        mButtonChoice3.setText(questionArray[mQuestionNumber].getOptionThree());
        mButtonChoice4.setText(questionArray[mQuestionNumber].getOptionFour());
        img.setImageResource(questionArray[mQuestionNumber].getImage());

        mAnswer = questionArray[mQuestionNumber].getCorrectAnswer();
        mQuestionNumber++;

    }

    Question q01 = new Question("Which animal is considered the only flying mammal?", R.drawable.ques_mark, "Flying Squirrel","Penguin","Bat","None of the above", "Bat");
    Question q02 = new Question("Which animal lay its eggs in the water?", R.drawable.ques_mark, "Lion","Giraffe","Elephant","Frog", "Frog");
    Question q03 = new Question("Which animal have very long neck?", R.drawable.ques_mark, "Beer","Giraffe","Leopard","Elephant", "Giraffe");
    Question q04 = new Question("How does Frogs catch their food?", R.drawable.ques_mark, "Mouth","Hands","Tongue","None of the above", "Tongue");
    Question q05 = new Question("Where did Pandas originate from?", R.drawable.ques_mark, "Egypt","Australia","South Korea","China", "China");
    Question q06 = new Question("What does Rhinoceros eat?", R.drawable.ques_mark, "Meat","Plants","Meat and Plants","None of the above", "Plants");
    Question q07 = new Question("How does a Kangaroo move around?", R.drawable.ques_mark, "Walking","Jumping","Running","All of the above", "Jumping");
    Question q08 = new Question("Within how long can baby Goats stand and take their first steps?", R.drawable.ques_mark, "Minutes","Days","Weeks","Months", "Minutes");
    Question q09 = new Question("Do male Gorillas often have the same body size of the females?", R.drawable.ques_mark, "Yes, they do","No, females often have bigger body","No, males often have bigger bodies","All of the above", "No, males often have bigger bodies");
    Question q10 = new Question("DE_R is missing one letter. What is it?", R.drawable.ques_mark, "A","E","I","R", "E");
    Question q11 = new Question("What happens when giant stars explode at the end of their lifecycle?", R.drawable.ques_mark, "Small stars are formed","Disappears","Forms a Black Hole","None of the above", "Forms a Black Hole");
    Question q12 = new Question("How long does it take for sun light to reach the earth?", R.drawable.ques_mark, "2 minutes","6 minutes","8 minutes","10 minutes", "8 minutes");
    Question q13 = new Question("What is the name of the fourth planet from the sun?", R.drawable.ques_mark, "Earth","Mars","Jupiter","Saturn", "Mars");
    Question q14 = new Question("How do dolphins breathe?", R.drawable.ques_mark, "Through their nose","Through their blow hole","Using their gills","None of the above", "Through their blow hole");
    Question q15 = new Question("What is the name of the following fruit?", R.drawable.pomegranate_big_pic, "Pear","Pineapple","Pomegranate","Pumpkin", "Pomegranate");
    Question q16 = new Question("What is the name of the following animal?", R.drawable.lion_big_pic, "Tiger","Leopard","Snake","Lion", "Lion");
    Question q17 = new Question("What is the correct spelling of the following animal?", R.drawable.kangaroo_big_pic, "Kangaroo","Kangroo","Kangeroo","Kangaro", "Kangaroo");
    Question q18 = new Question("What is the world's largest land animal?", R.drawable.ques_mark, "Whale","Elephant","Snake","Bear", "Elephant");
    Question q19 = new Question("What is the name of the following animal?", R.drawable.zebra_big_pic, "Horse","Donkey","Zebra","None of the above", "Zebra");
    Question q20 = new Question("What is the correct spelling of the following animal?", R.drawable.rhino_big_pic, "Rhinoseros","Rhinocros","Rhinoceros","Rhinosers", "Rhinoceros");
    Question q21 = new Question("What Panda's mostly eat?", R.drawable.ques_mark, "Meat","Fish","Plants","Bamboo", "Bamboo");
    Question q22 = new Question("How many planets are there our solar system?", R.drawable.ques_mark, "9","7","8","6", "8");
    Question q23 = new Question("How many moons does Mercury have", R.drawable.ques_mark, "2","None","1","3", "None");
    Question q24 = new Question("What is the fourth largest planet in our solar system?", R.drawable.ques_mark, "Venus","Uranus","Neptune","Saturn", "Neptune");
    Question q25 = new Question("What is the farthest planet from the sun?", R.drawable.ques_mark, "Jupiter","Neptune","Mercury","Saturn", "Neptune");
    Question q26 = new Question("Cantaloupes are good source of which vitamins?", R.drawable.cantaloupe_big_pic, "Vitamins A & B","Vitamins A & C","Vitamins B & C","Vitamins E & C", "Vitamins A & C");
    Question q27 = new Question("What is the name of the following fruit?", R.drawable.tangerine_big_pic, "Orange","Lemon","Peach","Tangerine", "Tangerine");
    Question q28 = new Question("How many limbs does and octopus has?", R.drawable.ques_mark, "7","10","8","6", "8");
    Question q29 = new Question("Where were onions first cultivated?", R.drawable.redonion_big_pic, "Japan","South Korea","China","Vietnam", "China");
    Question q30 = new Question("What is the correct spelling of the following animal?", R.drawable.squirrel_big_pic, "Squirel","Squirrel","Squirl","Squerril", "Squirrel");

    Question [] questionArray = new Question[]{
            q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, q21, q22, q23, q24, q25, q26, q27, q28, q29, q30
    };


    private void updateScore(int point) {
        mScoreView.setText("" + mScore);
    }

    public void shuffleQuestions(){
        Collections.shuffle(Arrays.asList(questionArray));
    }

}

我还创建了以下 Questions.class:

public class Question {

    private String question;
    private int image;
    private String optionOne, optionTwo, optionThree, optionFour;
    private String correctAnswer;

    public Question(String question, int image, String optionOne, String optionTwo, String optionThree, String optionFour, String correctAnswer) {
        this.question = question;
        this.image = image;
        this.optionOne = optionOne;
        this.optionTwo = optionTwo;
        this.optionThree = optionThree;
        this.optionFour = optionFour;
        this.correctAnswer = correctAnswer;
    }


    public String getQuestion() {
        return question;
    }

    public int getImage() {
        return image;
    }

    public String getOptionOne() {
        return optionOne;
    }

    public String getOptionTwo() {
        return optionTwo;
    }

    public String getOptionThree() {
        return optionThree;
    }

    public String getOptionFour() {
        return optionFour;
    }

    public String getCorrectAnswer() {
        return correctAnswer;
    }
}

如果代码有问题,请接受我的道歉,就像我说的,我对这一切都是新手,而且是自学的。因此,我们将不胜感激。

提前致谢

问题是您在 updateQuestion 中调用随机播放函数。因此它会在每次调用 updateQuestion 方法时更新 questionArray

解决方案

updateQuestion 方法中删除 shuffleQuestions(); 并将其添加到 updateQuestion();[=25= 之前] 在 onCreate 方法中,这样当加载 class 时,洗牌在开始时发生一次。

更新源代码

public class QuizQuestions extends AppCompatActivity {

    Button back;
    Toolbar toolbar;
    TextView toolText;
    private ImageView img;
    private TextView mScoreView;
    private TextView mQuestionView;
    private TextView mButtonChoice1;
    private TextView mButtonChoice2;
    private TextView mButtonChoice3;
    private TextView mButtonChoice4;
    private String mAnswer;
    private int mScore = 0;
    private int mQuestionNumber = 0;
    private Button nextQues;
    private ImageView dialogImg;
    private TextView dialogText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_quiz_questions);

        //Assign action bar
        toolbar = findViewById(R.id.toolbar3);
        setSupportActionBar(toolbar);
        //assign TextView in Toolbar
        toolText = findViewById(R.id.toolbar3_text);
        //setText of TextView in Toolbar
        toolText.setText("Quiz");

        //Assign back button
        back = findViewById(R.id.back);

        //setOnClickListener for back btn
        back.setOnClickListener(new View.OnClickListener() {
            //onClick for back button
            @Override
            public void onClick(View v) {
                Intent mainIntent = new Intent(QuizQuestions.this, MainActivity.class);
                startActivity(mainIntent);
            }//end of onClick
        });//end of setOnClickListener

        mScoreView = (TextView) findViewById(R.id.score);
        mQuestionView = (TextView) findViewById(R.id.quiz_question);
        mButtonChoice1 = (TextView) findViewById(R.id.option_one);
        mButtonChoice2 = (TextView) findViewById(R.id.option_two);
        mButtonChoice3 = (TextView) findViewById(R.id.option_three);
        mButtonChoice4 = (TextView) findViewById(R.id.option_four);
        img = (ImageView) findViewById(R.id.quiz_img);

        shuffleQuestions();
        updateQuestion();


        mButtonChoice1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mButtonChoice1.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice1.getText() == mAnswer) {

                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        mButtonChoice2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (mButtonChoice2.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }

                if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice2.getText() == mAnswer) {

                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        mButtonChoice3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (mButtonChoice3.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }
                if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice3.getText() == mAnswer) {
                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        mButtonChoice4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mButtonChoice4.getText() == mAnswer) {
                    mScore = mScore + 1;
                    updateScore(mScore);
                }
                if (mQuestionNumber > 9) {
                    Intent newIntent = new Intent(QuizQuestions.this, Results.class);
                    newIntent.putExtra("FINALSCORE", mScore);
                    startActivity(newIntent);
                } else {
                    AlertDialog.Builder mBuilder = new AlertDialog.Builder(QuizQuestions.this);
                    View mView = getLayoutInflater().inflate(R.layout.questions_dialog, null);

                    mBuilder.setView(mView);

                    dialogImg = (ImageView) mView.findViewById(R.id.dialog_image);
                    dialogText = (TextView) mView.findViewById(R.id.dialog_text);
                    nextQues = (Button) mView.findViewById(R.id.next_question);


                    AlertDialog dialog = mBuilder.create();

                    if (mButtonChoice4.getText() == mAnswer) {

                        dialogImg.setImageResource(R.drawable.right);
                        dialogText.setText("Well Done!!");

                    } else {

                        dialogImg.setImageResource(R.drawable.wrong);
                        dialogText.setText("Oops, you missed that!!");
                    }


                    nextQues.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            {

                                updateQuestion();
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                }
            }

        });

        }



    private void updateQuestion(){
        mQuestionView.setText(questionArray[mQuestionNumber].getQuestion());
        mButtonChoice1.setText(questionArray[mQuestionNumber].getOptionOne());
        mButtonChoice2.setText(questionArray[mQuestionNumber].getOptionTwo());
        mButtonChoice3.setText(questionArray[mQuestionNumber].getOptionThree());
        mButtonChoice4.setText(questionArray[mQuestionNumber].getOptionFour());
        img.setImageResource(questionArray[mQuestionNumber].getImage());

        mAnswer = questionArray[mQuestionNumber].getCorrectAnswer();
        mQuestionNumber++;

    }

    Question q01 = new Question("Which animal is considered the only flying mammal?", R.drawable.ques_mark, "Flying Squirrel","Penguin","Bat","None of the above", "Bat");
    Question q02 = new Question("Which animal lay its eggs in the water?", R.drawable.ques_mark, "Lion","Giraffe","Elephant","Frog", "Frog");
    Question q03 = new Question("Which animal have very long neck?", R.drawable.ques_mark, "Beer","Giraffe","Leopard","Elephant", "Giraffe");
    Question q04 = new Question("How does Frogs catch their food?", R.drawable.ques_mark, "Mouth","Hands","Tongue","None of the above", "Tongue");
    Question q05 = new Question("Where did Pandas originate from?", R.drawable.ques_mark, "Egypt","Australia","South Korea","China", "China");
    Question q06 = new Question("What does Rhinoceros eat?", R.drawable.ques_mark, "Meat","Plants","Meat and Plants","None of the above", "Plants");
    Question q07 = new Question("How does a Kangaroo move around?", R.drawable.ques_mark, "Walking","Jumping","Running","All of the above", "Jumping");
    Question q08 = new Question("Within how long can baby Goats stand and take their first steps?", R.drawable.ques_mark, "Minutes","Days","Weeks","Months", "Minutes");
    Question q09 = new Question("Do male Gorillas often have the same body size of the females?", R.drawable.ques_mark, "Yes, they do","No, females often have bigger body","No, males often have bigger bodies","All of the above", "No, males often have bigger bodies");
    Question q10 = new Question("DE_R is missing one letter. What is it?", R.drawable.ques_mark, "A","E","I","R", "E");
    Question q11 = new Question("What happens when giant stars explode at the end of their lifecycle?", R.drawable.ques_mark, "Small stars are formed","Disappears","Forms a Black Hole","None of the above", "Forms a Black Hole");
    Question q12 = new Question("How long does it take for sun light to reach the earth?", R.drawable.ques_mark, "2 minutes","6 minutes","8 minutes","10 minutes", "8 minutes");
    Question q13 = new Question("What is the name of the fourth planet from the sun?", R.drawable.ques_mark, "Earth","Mars","Jupiter","Saturn", "Mars");
    Question q14 = new Question("How do dolphins breathe?", R.drawable.ques_mark, "Through their nose","Through their blow hole","Using their gills","None of the above", "Through their blow hole");
    Question q15 = new Question("What is the name of the following fruit?", R.drawable.pomegranate_big_pic, "Pear","Pineapple","Pomegranate","Pumpkin", "Pomegranate");
    Question q16 = new Question("What is the name of the following animal?", R.drawable.lion_big_pic, "Tiger","Leopard","Snake","Lion", "Lion");
    Question q17 = new Question("What is the correct spelling of the following animal?", R.drawable.kangaroo_big_pic, "Kangaroo","Kangroo","Kangeroo","Kangaro", "Kangaroo");
    Question q18 = new Question("What is the world's largest land animal?", R.drawable.ques_mark, "Whale","Elephant","Snake","Bear", "Elephant");
    Question q19 = new Question("What is the name of the following animal?", R.drawable.zebra_big_pic, "Horse","Donkey","Zebra","None of the above", "Zebra");
    Question q20 = new Question("What is the correct spelling of the following animal?", R.drawable.rhino_big_pic, "Rhinoseros","Rhinocros","Rhinoceros","Rhinosers", "Rhinoceros");
    Question q21 = new Question("What Panda's mostly eat?", R.drawable.ques_mark, "Meat","Fish","Plants","Bamboo", "Bamboo");
    Question q22 = new Question("How many planets are there our solar system?", R.drawable.ques_mark, "9","7","8","6", "8");
    Question q23 = new Question("How many moons does Mercury have", R.drawable.ques_mark, "2","None","1","3", "None");
    Question q24 = new Question("What is the fourth largest planet in our solar system?", R.drawable.ques_mark, "Venus","Uranus","Neptune","Saturn", "Neptune");
    Question q25 = new Question("What is the farthest planet from the sun?", R.drawable.ques_mark, "Jupiter","Neptune","Mercury","Saturn", "Neptune");
    Question q26 = new Question("Cantaloupes are good source of which vitamins?", R.drawable.cantaloupe_big_pic, "Vitamins A & B","Vitamins A & C","Vitamins B & C","Vitamins E & C", "Vitamins A & C");
    Question q27 = new Question("What is the name of the following fruit?", R.drawable.tangerine_big_pic, "Orange","Lemon","Peach","Tangerine", "Tangerine");
    Question q28 = new Question("How many limbs does and octopus has?", R.drawable.ques_mark, "7","10","8","6", "8");
    Question q29 = new Question("Where were onions first cultivated?", R.drawable.redonion_big_pic, "Japan","South Korea","China","Vietnam", "China");
    Question q30 = new Question("What is the correct spelling of the following animal?", R.drawable.squirrel_big_pic, "Squirel","Squirrel","Squirl","Squerril", "Squirrel");

    Question [] questionArray = new Question[]{
            q01, q02, q03, q04, q05, q06, q07, q08, q09, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, q21, q22, q23, q24, q25, q26, q27, q28, q29, q30
    };


    private void updateScore(int point) {
        mScoreView.setText("" + mScore);
    }

    public void shuffleQuestions(){
        Collections.shuffle(Arrays.asList(questionArray));
    }

}