-3

I don't know what is happening to my app.

This is the java code:

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

        configureNextButton();

    }
    private void configureNextButton(){
        Button nextButton = (Button) findViewById(R.id.PlayButton);
        nextButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this,SelectDifficultyActivity.class));
            }
        });
    }
} 

this is the xml code:

 <TextView
        android:id="@+id/MainActTitle"
        android:layout_marginTop="40dp"
        android:layout_gravity="center"
        android:textColor="#FFF"
        android:textSize="22sp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/ict_word_puzzle" />


    <ImageView
        android:id="@+id/bigboss"
        android:layout_gravity="center"
        android:layout_marginTop="90dp"
        android:src="@drawable/icboss"
        android:layout_width="180dp"
        android:layout_height="180dp"
        android:contentDescription="TODO" />




    <Button
        android:layout_gravity="center"
        android:layout_marginTop="80dp"
        android:id="@+id/PlayButton"
        android:textAllCaps="false"
        android:textColor="#000"
        android:text="@string/play"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:textSize="28sp"
        android:background="@drawable/bgbtn"
        android:layout_width="280dp"
        android:layout_height="70dp"
        android:textAlignment="center"

        />


    <Button
        android:paddingTop="10dp"
        android:id="@+id/AbtBtn"
        android:layout_width="280dp"
        android:layout_height="70dp"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:background="@drawable/bgbtn"
        android:paddingBottom="10dp"
        android:text="@string/about"
        android:textAlignment="center"
        android:textAllCaps="false"
        android:textColor="#000"
        android:textSize="28sp" />>

and this is the logcat:

2021-01-12 11:06:48.701 5132-5132/com.example.programmingwordquizgame E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.programmingwordquizgame, PID: 5132
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.programmingwordquizgame/com.example.programmingwordquizgame.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

 at com.example.programmingwordquizgame.MainActivity.onCreate(MainActivity.java:15)

Here is the code when I click the (MainActivity.java:15)

 setContentView(R.layout.activity_main);
Jhon Dev
  • 1
  • 2
  • Forgot to say that when i start my app it just opening the previous app that i make and said "can't open 'name of the other app' " – Jhon Dev Jan 12 '21 at 03:28
  • `What is happening to my app?` doesn't help anyone understand your question, please use more descriptive question titles in future – a_local_nobody Jan 12 '21 at 06:37

2 Answers2

0

You should check styles.xml and change Theme.ProgrammingWordQuizGame with Theme.AppCompat.Light.DarkActionBar or choose parent your theme custom by Theme.AppCompat.other...

tienminh
  • 33
  • 5
-1

Try this,

  1. File/Sync Project with Gradle files or
  2. File/ Invalided catches and restart