Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我在androidstudio上有一个错误,指出OnClick方法无法执行_Android - Fatal编程技术网

我在androidstudio上有一个错误,指出OnClick方法无法执行

我在androidstudio上有一个错误,指出OnClick方法无法执行,android,Android,以下是错误: "FATAL EXCEPTION: main Process: com.example.sandhanda.quizactivity, PID: 7935 java.lang.IllegalStateException: Could not execute method for android:onClick at an

以下是错误:

    "FATAL EXCEPTION: main Process: com.example.sandhanda.quizactivity, PID: 7935                                                                          java.lang.IllegalStateException: Could not execute method for android:onClick 
    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
   at android.view.View.performClick(View.java:5233)
   at android.view.View$PerformClick.run(View.java:21209)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:152)
   at android.app.ActivityThread.main(ActivityThread.java:5507)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)"
代码如下:

public void ShowLastAttemptData (View view){
        Bundle extras = getIntent().getExtras();
        String user = extras.getString("User");

    int topic1Score = a.getScore();
    int topic2Score = b.getScore();
    int topic3Score = c.getScore();
    int topic4Score = d.getScore();
    int topic5Score = e.getScore();

    int percent = (((topic1Score + topic2Score + topic3Score + topic4Score + topic5Score)*100)/50);

    Topic1LastAttempt.setText(topic1Score + "");
    Topic2LastAttempt.setText(topic2Score + "");
    Topic3LastAttempt.setText(topic3Score + "");
    Topic4LastAttempt.setText(topic4Score + "");
    Topic5LastAttempt.setText(topic5Score + "");
    LastAttemptPercentage.setText(percent + "%");

    ScoreDBClass dbandler = new ScoreDBClass(this, null, null, 3);

    Scores userScore = new Scores(user, topic1Score, topic2Score,topic3Score, topic4Score, topic5Score);
    dbandler.addScore(userScore);

topic1Score是一个整数。Settext只接受字符串。将其转换为字符串,然后查看。所有人都是如此

 Topic1LastAttempt.setText(Integer.toString(topic1Score) + "");

什么是a,b,c,d,e?