I’m trying to build the app using android studio at the end of chapter 1 – unfortunately, I’m getting two errors for both the True and False setOnClickListeners. I’m fairly rusty at programming - haven’t done any java in +10 years and even then it was fairly intro, so please have mercy on me !
Error:(20, 67) error: <anonymous com.bignerdranch.android.geoquiz.QuizActivity$1> is not abstract and does not override abstract method onClick(View) in OnClickListener
Error:(21, 13) error: method does not override or implement a method from a supertype
Error:(28, 67) error: <anonymous com.bignerdranch.android.geoquiz.QuizActivity$2> is not abstract and does not override abstract method onClick(View) in OnClickListener
Error:(29, 13) error: method does not override or implement a method from a supertype
Here is my QuizActivity.java.
package com.bignerdranch.android.geoquiz;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class QuizActivity extends AppCompatActivity {
private Button mTrueButton;
private Button mFalseButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz);
mTrueButton = (Button) findViewById(R.id.true_button);
mTrueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClickView(View v) {
Toast.makeText(QuizActivity.this, R.string.correct_toast, Toast.LENGTH_SHORT).show();
}
});
mFalseButton = (Button) findViewById(R.id.false_button);
mFalseButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClickView(View v) {
Toast.makeText(QuizActivity.this, R.string.incorrect_toast, Toast.LENGTH_SHORT).show();
}
});
}
}