I ran the same project with different codes and it ran fine with some errors that were from my side.But I tried to run another code and it says there is an error with insets code that came prre-built when the project was created.

Error–>error: ‘)’ expected
Insets systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars());


import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.widget.TextView;
import android.widget.SearchView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import java.text.BreakIterator;

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {

        // Find the root view of your layout and apply insets
        View rootView = findViewById(android.R.id.content);
        ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) ->
                Insets systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars());`Error here`

        v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
            String data = SearchView.getQuery();
            Button button = findViewById(R.id.button2);
            final TextView textView = findViewById(R.id.textView);
            button.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {


New contributor

Naham Rolex is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.