尝试在空对象引用上调用虚拟方法'java.lang.String com.kunal.quiz.Model.User.getEmail()'

时间:2019-11-09 11:19:52

标签: java android firebase

我遇到了错误: 原因:java.lang.NullPointerException:尝试在空对象引用上调用虚拟方法'java.lang.String com.kunal.quiz.Model.User.getEmail()'

我尝试了以下代码

Bundle extra = getIntent().getExtras();
        if (extra!=null){
            int Score = extra.getInt("SCORE");
            int totalQuestion = extra.getInt("TOTAL");
            int correctAnswer = extra.getInt("CORRECT");

            txtResultScore.setText(String.format("%d",Score));
            getTxtResultQuestion.setText(String.format("Passed : %d / %d",correctAnswer,totalQuestion));
            progressBar.setMax(totalQuestion);
            progressBar.setProgress(correctAnswer);


            question_score.child(String.format("%s_%s", Common.currentUser.getEmail(),Common.categoryId))
                    .setValue(new QuestionScore(String.format("%s_%s",Common.currentUser.getEmail(),
                            Common.categoryId),Common.currentUser.getEmail(),String.valueOf(Score)));
        }

该应用程序不应崩溃....请帮助

0 个答案:

没有答案