Loading app/src/main/java/com/example/game2d/ChalkActivity.java +12 −6 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package com.example.game2d; import androidx.appcompat.app.AppCompatActivity; import android.app.AlertDialog; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; Loading Loading @@ -97,19 +98,24 @@ public class ChalkActivity extends AppCompatActivity implements View.OnClickList Button clickedButton = (Button) view; if(clickedButton.getId()==R.id.submit_btn){ if(selectedAnswer.equals(ChalkQuestionAnswer.correctAnswers[currentQuestionIndex])){ if(selectedAnswer == "") { new AlertDialog.Builder(this) .setMessage("Please select an answer") .show(); } else if(selectedAnswer.equals(ChalkQuestionAnswer.correctAnswers[currentQuestionIndex])){ chalkscore++; currentQuestionIndex++; loadNewQuestion(); } else { totalWrong++; Intent spawnGame = new Intent(getApplicationContext(), ChalkGameActivity.class); spawnGame.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); Log.d("QUESTION", "Starting activity..."); getApplicationContext().startActivity(spawnGame); } currentQuestionIndex++; loadNewQuestion(); } } else { //choices button clicked selectedAnswer = clickedButton.getText().toString(); Loading app/src/main/res/layout/activity_chalk.xml +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:layout_marginBottom="10dp" android:layout_marginBottom="5dp" android:text="What is the correct machine code for the following?" android:textAlignment="center" android:textColor="@color/white" Loading Loading
app/src/main/java/com/example/game2d/ChalkActivity.java +12 −6 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package com.example.game2d; import androidx.appcompat.app.AppCompatActivity; import android.app.AlertDialog; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; Loading Loading @@ -97,19 +98,24 @@ public class ChalkActivity extends AppCompatActivity implements View.OnClickList Button clickedButton = (Button) view; if(clickedButton.getId()==R.id.submit_btn){ if(selectedAnswer.equals(ChalkQuestionAnswer.correctAnswers[currentQuestionIndex])){ if(selectedAnswer == "") { new AlertDialog.Builder(this) .setMessage("Please select an answer") .show(); } else if(selectedAnswer.equals(ChalkQuestionAnswer.correctAnswers[currentQuestionIndex])){ chalkscore++; currentQuestionIndex++; loadNewQuestion(); } else { totalWrong++; Intent spawnGame = new Intent(getApplicationContext(), ChalkGameActivity.class); spawnGame.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); Log.d("QUESTION", "Starting activity..."); getApplicationContext().startActivity(spawnGame); } currentQuestionIndex++; loadNewQuestion(); } } else { //choices button clicked selectedAnswer = clickedButton.getText().toString(); Loading
app/src/main/res/layout/activity_chalk.xml +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:layout_marginBottom="10dp" android:layout_marginBottom="5dp" android:text="What is the correct machine code for the following?" android:textAlignment="center" android:textColor="@color/white" Loading