これが私のJavaコードです。"Fatal Exception main"
アプリを正常に実行したいというエラーが発生しました。
私を助けてください。私はAndroidが初めてです
if(queList.size() == question_Counter+1) {
// answerList = new ArrayList<String>();
final int count= dbhelper.getCorrectAnswerCount(answerList);
count1=count;
Log.d("bachhhaaaa**********", "Test Activity"+count1);
String TotalMark = dbhelper.totalMark();
Log.d("TEST<<<<<<<<<<<<TotalMark", TotalMark);
String NoOfQuestion =dbhelper.noOfQuestion();
Log.d("TEST<<<<<<<<<<<<NoOfQuestion", NoOfQuestion);
int perQuestionValue=0;
perQuestionValue= Integer.parseInt(TotalMark) /Integer.parseInt(NoOfQuestion);
int TotalCountMark=0;
TotalCountMark = count1 * perQuestionValue;
String answerString = "Answer";
for(int i=0;i<answerList.size();i++){
answerString = answerString+","+answerList.get(i);
}
String statusStringOfUserAnswer = dbhelper.getStatusStringOfUserAnswer(answerList);
dbhelper.saveOrigionalMarkInDatabase(TotalCountMark,answerString,statusStringOfUserAnswer); // saves users total marks into database
Intent intent =new Intent(TestActivity.this,Result.class);
intent.putExtra("answerString", answerString);
intent.putExtra("statusStringOfUserAnswer", statusStringOfUserAnswer);
intent.putExtra("AllResult", count1);
startActivity(intent);
finish();
return;
}
これは私のlogcatです:
03-12 03:09:45.001: E/AndroidRuntime(2055): FATAL EXCEPTION: main
03-12 03:09:45.001: E/AndroidRuntime(2055): java.lang.ArithmeticException: divide by zero
03-12 03:09:45.001: E/AndroidRuntime(2055): at com.example.exam.TestActivity$1.onClick(TestActivity.java:132)
03-12 03:09:45.001: E/AndroidRuntime(2055): at android.view.View.performClick(View.java:4204)
03-12 03:09:45.001: E/AndroidRuntime(2055): at android.view.View$PerformClick.run(View.java:17355)
03-12 03:09:45.001: E/AndroidRuntime(2055): at android.os.Handler.handleCallback(Handler.java:725)
03-12 03:09:45.001: E/AndroidRuntime(2055): at android.os.Handler.dispatchMessage(Handler.java:92)
03-12 03:09:45.001: E/AndroidRuntime(2055): at android.os.Looper.loop(Looper.java:137)
03-12 03:09:45.001: E/AndroidRuntime(2055): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-12 03:09:45.001: E/AndroidRuntime(2055): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 03:09:45.001: E/AndroidRuntime(2055): at java.lang.reflect.Method.invoke(Method.java:511)
03-12 03:09:45.001: E/AndroidRuntime(2055): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-12 03:09:45.001: E/AndroidRuntime(2055): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-12 03:09:45.001: E/AndroidRuntime(2055): at dalvik.system.NativeStart.main(Native Method)