I'm following this tutorial: http://www.i-programmer.info/programming/android/10051-android-adventures-events.html?start=1
If you scroll down the header: Implement the interface in the activity
The picture shows an implement error, though I'm getting the 'Cannot resolve symbol Error'
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
// import android.view.View.OnClickListener
public class MainActivity extends AppCompatActivity implements View.onClickListener {
@Override
public void onClick(View v) {
//Handle event
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(this);
}
}
You need to start with a capital letter on OnClickListener, change:
... implements View.onClickListener {
to
... implements View.OnClickListener {
Additionally, since you have imported:
import android.view.View.OnClickListener;
you can ommit View
in View.OnClickListener
, that is:
public class MainActivity extends AppCompatActivity implements OnClickListener {
Also, as a suggestion for future questions, please insert your code as text in the question, not as an image as it makes it possible for us to copy-paste rather than rewrite everything.