2016-12-15 11 views
-1

を実行することができなかったと述べているアンドロイドスタジオでのエラーを持っているが、エラーである:ここでは私はここのOnClickメソッドは

"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); 
+0

a、b、c、d、eとは何ですか? –

答えて

0

あなたtopic1Scoreは整数です。 Settextは文字列のみを受け入れます。それを文字列に変換してから参照してください。同様にすべてのために。

Topic1LastAttempt.setText(Integer.toString(topic1Score) + ""); 
関連する問題