I added a Welcome activity to start my Android app and which then calls up my MainActivity.java.
I swapped over the entries in the AndroidManifest.xml file and tested the Welcome activity started up the app.
This worked as I expected.
However, when I added a simple OnClickListener to the Welcome.java file I get the attached attached.
I’ve upset Android Studio and can’t proceed.
I’m very new to Android app development and so this is likely to be a stupid error.
This is a syntax error it won’t run the app but is unhappy with the line:-
Intent intent = new Intent(this, MainActivity.class);
1 – Changed the AndroidManifest.xml file
2 – Added the following code to my Welcome.java:-
public class Welcome extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_welcome);
Button button= (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
});
}
}
3-tried the autocorrect actions suggested nothing helps