Hello kind human,
I just started with Java in Android Studio and I’m just an hour in (no experience with coding). Im folowing this YouTube guide posted under the same name as this website, so I guess this is the place to be. Here is the link of the video with the time stamp: https://youtu.be/fis26HvvDII?t=3129
I am getting 2 errors on this part:
-
error: expected
Public void onBtnClick (View view) {
^ -
error: invalid method declaration; return type required
Public void onBtnClick (View view) {
^
Ill post my code below but I dont see anything that differs with the tutorial. I am running on Android 30 and the guide is on Android 29, thats the only difference I can think of.
Thanks a lot for reading this / helping me out getting started!
package com.example.helloworld2;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity<Public> extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Public void onBtnClick (View view) {
TextView txtHello = findViewById(R.id.txtMessage) ;
txtHello.setText("Hello");
}
}