Я хочу чтобы нижнее меню исчезало когда я запускаю регистрацию вот необходимый код : package com.example.myapp_2;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.fragment.app.Fragment;

import com.example.myapp_2.UI.view.activities.MainActivity;

import java.util.List;

public class RegistrationFragment extends Fragment {

    private EditText editTextName, editTextEmail, editTextPassword;
    private Button buttonRegister_1;

    private UserDAO userDAO;

    public RegistrationFragment() {

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        userDAO = new UserDAO(getActivity());
        userDAO.open();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.refister, container, false);

        editTextName = view.findViewById(R.id.editTextName);
        editTextEmail = view.findViewById(R.id.editTextEmail);
        editTextPassword = view.findViewById(R.id.editTextPassword);
        buttonRegister_1 = view.findViewById(R.id.buttonRegister_1);

        buttonRegister_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = editTextName.getText().toString();
                String email = editTextEmail.getText().toString();
                String password = editTextPassword.getText().toString();

                long rowID = userDAO.register(name, email, password);

                if (rowID > 0) {
                    Toast.makeText(getActivity(), "Registration successful", Toast.LENGTH_SHORT).show();

// вывод всех пользователей в лог
                    List<User> users = userDAO.getAllUsers();
                    Log.d("UserDatabase", "All users:");
                    for (User user : users) {
                        Log.d("UserDatabase", user.toString());
                    }

                    getActivity().onBackPressed(); // возвращаемся на предыдущий экран
                } else if (rowID == -1) {
                    Toast.makeText(getActivity(), "Invalid email", Toast.LENGTH_SHORT).show();

                } else {
                    Toast.makeText(getActivity(), "Registration failed", Toast.LENGTH_SHORT).show();
                }
            }
        });

        return view;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        userDAO.close();
    }
}

package com.example.myapp_2;

public class User {
    private int id;
    private String name;
    private String email;
    private String password;

    public User() {
    }

    public User(int id, String name, String email, String password) {
        this.id = id;
        this.name = name;
        this.email = email;
        this.password = password;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "User {id=" + id + ", name='" + name + "‘, email=’" + email + "‘, password=’" + password + "'}";
    }
}package com.example.myapp_2;

import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

import java.util.ArrayList;
import java.util.List;

public class UserDAO {

    private SQLiteDatabase database;
    private UserDatabaseHelper dbHelper;

    public UserDAO(Context context) {
        dbHelper = new UserDatabaseHelper(context);
    }

    public void open() throws SQLException {
        database = dbHelper.getWritableDatabase();
    }

    public void close() {
        dbHelper.close();
    }

    public long register(String name, String email, String password) {
        if (!android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
            return -1; // email не соответствует формату
        }

        ContentValues values = new ContentValues();
        values.put(UserDatabaseHelper.COLUMN_NAME, name);
        values.put(UserDatabaseHelper.COLUMN_EMAIL, email);
        values.put(UserDatabaseHelper.COLUMN_PASSWORD, password);

        return database.insert(UserDatabaseHelper.TABLE_USERS, null, values);
    }

    public boolean login(String email, String password) {
        Cursor cursor = database.query(UserDatabaseHelper.TABLE_USERS,
                new String[]{UserDatabaseHelper.COLUMN_EMAIL, UserDatabaseHelper.COLUMN_PASSWORD},
                UserDatabaseHelper.COLUMN_EMAIL + " = ? AND " + UserDatabaseHelper.COLUMN_PASSWORD + " = ?",
        new String[]{email, password}, null, null, null, null);

        if (cursor != null && cursor.getCount() > 0) {
            cursor.close();
            return true;
        } else {
            return false;
        }
    }

    @SuppressLint("Range")
    public List<User> getAllUsers() {
        List<User> users = new ArrayList<>();

        Cursor cursor = database.query(UserDatabaseHelper.TABLE_USERS,
                new String[]{UserDatabaseHelper.COLUMN_ID, UserDatabaseHelper.COLUMN_NAME,
                        UserDatabaseHelper.COLUMN_EMAIL, UserDatabaseHelper.COLUMN_PASSWORD},
                null, null, null, null, null);

        if (cursor != null && cursor.moveToFirst()) {
            do {
                User user = new User();
                user.setId(cursor.getInt(cursor.getColumnIndex(UserDatabaseHelper.COLUMN_ID)));
                user.setName(cursor.getString(cursor.getColumnIndex(UserDatabaseHelper.COLUMN_NAME)));
                user.setEmail(cursor.getString(cursor.getColumnIndex(UserDatabaseHelper.COLUMN_EMAIL)));
                user.setPassword(cursor.getString(cursor.getColumnIndex(UserDatabaseHelper.COLUMN_PASSWORD)));

                users.add(user);
            } while (cursor.moveToNext());

            cursor.close();
        }

        return users;
    }
}
package com.example.myapp_2;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class UserDatabaseHelper extends SQLiteOpenHelper {

    private static final int DATABASE_VERSION = 1;
    private static final String DATABASE_NAME = "UserDatabase";

    public static final String TABLE_USERS = "users";
    public static final String COLUMN_ID = "_id";
    public static final String COLUMN_NAME = "name";
    public static final String COLUMN_EMAIL = "email";
    public static final String COLUMN_PASSWORD = "password";

    public UserDatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String CREATE_USERS_TABLE = "CREATE TABLE " + TABLE_USERS + "("
                + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                + COLUMN_NAME + " TEXT,"
                + COLUMN_EMAIL + " TEXT,"
                + COLUMN_PASSWORD + " TEXT"
                + ")";
        db.execSQL(CREATE_USERS_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_USERS);
                onCreate(db);
    }
}package com.example.myapp_2.UI.view.activities;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.myapp_2.Data.model.database.Room.SQLITE.Note;
import com.example.myapp_2.ViewModel.ViewModels.NoteViewModel;
import com.example.myapp_2.R;
import com.example.myapp_2.UI.view.fragments.FirstFragment;
import com.example.myapp_2.UI.view.fragments.SecondFragment;
import com.example.myapp_2.UI.view.fragments.ThirdFragment;
import com.example.myapp_2.databinding.ActivityMainBinding;

import java.util.List;


import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.myapp_2.Data.model.database.Room.SQLITE.Note;
import com.example.myapp_2.ViewModel.ViewModels.NoteViewModel;
import com.example.myapp_2.R;
import com.example.myapp_2.UI.view.fragments.FirstFragment;
import com.example.myapp_2.UI.view.fragments.SecondFragment;
import com.example.myapp_2.UI.view.fragments.ThirdFragment;
import com.example.myapp_2.databinding.ActivityMainBinding;

import java.util.List;


public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private NoteViewModel noteViewModel;

    private BroadcastReceiver broadcastReceiver;

    public  static boolean isRegister;
    Button button1;
    Button button3;
    // private FirstFragment firstFragment = new FirstFragment();
    ActivityMainBinding binding;
    private Button btn_fragment1,btn_fragment2,btn_fragment3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        replaceFragment(new FirstFragment());

        binding.bottomNavigationView.setOnItemSelectedListener(item -> {
            switch(item.getItemId()){
                case R.id.home:

                    replaceFragment(new FirstFragment());
                    break;
                case R.id.profile:
                    replaceFragment(new SecondFragment());
                    break;
                case R.id.settings:
                    replaceFragment(new ThirdFragment());
                    break;
            }
            return true;
        });

        getSupportFragmentManager().beginTransaction().replace(R.id.nav_container, new FirstFragment()).addToBackStack(null).commit();

        if (isRegister) {
            binding.bottomNavigationView.setVisibility(View.GONE);
        } else {
            binding.bottomNavigationView.setVisibility(View.VISIBLE);
        }
    }

    private void registerBroadcastReceiver() {
        broadcastReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
// Получение сообщения
                String action = intent.getAction();
                if(action.equals("com.example.myapplication_2.SEND_MESSAGE")) {
                    String message = intent.getStringExtra("MESSAGE");
// Вывод сообщения в лог
                    Log.d("MyApp2", "Received message: " + message);
                }
            }
        };
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.example.myapplication_2.SEND_MESSAGE");
        registerReceiver(broadcastReceiver, intentFilter);
    }


    @Override
    public void onClick(View view) {//2 способ

    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
// Удаление приемника
        unregisterReceiver(broadcastReceiver);
    }

    private void replaceFragment(Fragment fragment){
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.nav_container,fragment);
        String A = "HELLO";


        Bundle bundle = new Bundle();
        bundle.putInt("hello world", 4344);
        fragment.setArguments(bundle);


        fragmentTransaction.commit();

    }

}