New to Java, using Eclipse. Except this error I also got some:
Description Resource Path Location Type The method onClick(View) of type new onClickListener
Try this:
Button button1 ,button2;
@Override
public void onCreate(Bundle SavedInstanceState) {
super.onCreate(SavedInstanceState);
setContentView(R.layout.activity_main);
button1 = (Button)findViewById(R.id.button1);
button2 = (Button)findViewById(R.id.button2);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
button1.setText("xyz");
}
});
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
button2.setText("abc");
}
});
}