fix the code

package com.example.profile;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;

public class MainActivity extends AppCompatActivity {
    DrawerLayout drawerLayout;
    

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

            FirebaseDatabase database = FirebaseDatabase.getInstance();
            DatabaseReference myRef = database.getReference("predict");
            Query query = myRef.orderByChild("timestamp").limitToLast(1);
            query.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                    Log.d("FirebaseDebug", "onDataChange: Data received"); // Add this line

                    for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                        // Get the "soreness_label", "gsr_data" and "emg_data" from the latest entry
                        String latestSorenessLabel = snapshot.child("soreness_label").getValue(String.class);
                        Integer latestGsrData = snapshot.child("gsr_data").getValue(Integer.class);
                        Integer latestEmgData = snapshot.child("emg_data").getValue(Integer.class);

                        // Combine values to be displayed
                        String combinedValues = "Soreness Label: " + latestSorenessLabel +
                                "\nGSR Data: " + latestGsrData +
                                "\nEMG Data: " + latestEmgData;


                        // Display combined values in the TextView
                        TextView textViewData = findViewById(R.id.textViewData);
                        textViewData.setText(combinedValues);
                    }
                }

                @Override
                public void onCancelled(@NonNull DatabaseError databaseError) {
                    Log.d("FirebaseDebug", "onCancelled: Error encountered"); // Add this line
                    Log.w("Error", "Failed to read value.", databaseError.toException());
                }
            });
        }
    }






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

        drawerLayout=findViewById(R.id.drawer);

    }

    public void ClickMenu(View view){
        openDrawer(drawerLayout);
    }

    static void openDrawer(DrawerLayout drawerLayout) {

        drawerLayout.openDrawer(GravityCompat.START);

    }

    public void ClickLogo(View view){
        closeDrawer(drawerLayout);
    }

    public static void closeDrawer(DrawerLayout drawerLayout) {
        if(drawerLayout.isDrawerOpen(GravityCompat.START)){
            drawerLayout.closeDrawer(GravityCompat.START);
        }

    }

    public void ClickHome(View view){
        recreate();
    }
    public void ClickProfile(View view){
        redirectActivity(this,Profile.class);
    }

    public void ClickResult(View view){
        redirectActivity(this,Result.class);
    }

    public void ClickAction(View view){
        redirectActivity(this,Action.class);
    }

    public void ClickLogout(View view){
        logout(this);
    }

    static void logout(Activity activity) {
        AlertDialog.Builder builder=new AlertDialog.Builder(activity);
        builder.setTitle("Logout");
        builder.setMessage("Are you sure you want to logout?");
        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                activity.finishAffinity();
                System.exit(0);
            }
        });
        builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
        builder.show();

    }

    public static void redirectActivity(Activity activity, Class Class) {
        Intent intent=new Intent(activity,Class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        activity.startActivity(intent);
    }

    @Override
    protected void onPause() {
        super.onPause();
        closeDrawer(drawerLayout);
    }



}

Activity_main.xml for context
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drawer"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/bg"
        android:orientation="vertical">

        <include
            layout = "@layout/main_toolbar"
            />

        <TextView
            android:layout_width='match_parent'
            android:layout_height='match_parent'
            android:text=''
            android:textSize='52sp'
            android:textStyle='bold'
            android:textColor='@color/black'
            android:gravity='center'
            android:id='@+id/textViewData'
            />

    </LinearLayout>

    <RelativeLayout
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:layout_gravity="start">

        <include
            layout = "@layout/main_navigation_drawer"
            />

    </RelativeLayout>






</androidx.drawerlayout.widget.DrawerLayout>