New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Try this: So I deleted the "setContentView" in the on click method and I added a space before the "findViewById". If this doesn't work please show me the copy of your xml file
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onButtonClick(View v){
TextView t2 = (TextView) findViewById(R.id.textView2);
t2.setText("LITTERALLY ANYTHING");
}
}
+ 2
OK perfect then