I am new to android and i am trying to change the text by clicking button but i am getting the error "can not resolve setOnClickListener" on third line.how can i resolve this?
Button b=(Button)findViewById(R.id.button);
b.setOnClickListener(
new Button.setOnClickListener(){ //error in this line
public void onclick(View v){
TextView t=(TextView)findViewById(R.id.textView2);
t.setText("text changed!");
}
}
);