public class Button extends AppCompatActivity {
TextView txtvHoTen;
Button btnHello;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_button);
btnHello = (Button) findViewById(R.id.buttonHello);
txtvHoTen = (TextView)findViewById(R.id.textViewHello);
btnHello.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
txtvHoTen.setText("Hello Everybody");
}
});
}
}
Đoạn code này nó báo không có phương thức setOnClickListener. Tại sao vậy nhỉ?
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?