Error without class, interface, or enum

Asked 2 years ago, Updated 2 years ago, 50 views

I am making an app in Android studio, but I got an error saying that there are 6 classes, interface, or enum missing.
MainActivity.java has the following information:

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

public class MainActivity extensions AppCompatActivity{

    @ Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ImageView imageView 1= (ImageView) findViewById (R.id.feminine);
    }


    protected void onCreate (Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);

         ImageView imageView 2= (ImageView) findViewById (R.id.bigfig);
         imageView2.setImageResource(R.drawable.bigfig);
    }
 }

Looking at other people's errors, this error appears because there are not enough {}, but is it still there?

android java

2022-09-30 20:14

2 Answers

{} has no problem

  • Two onCreate
  • R is not defined anywhere

I guess it's from


2022-09-30 20:14

class, interface, or enum missing

Rather, I think there are more problems with having two onCreate(Bundle SavedInstanceState).
I thought the number of {} would be fine...
Try erasing one of the onCreate, changing arguments, changing names, etc.
Otherwise, there seems to be a problem with another source code.
Maybe the error message is different.


2022-09-30 20:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.