I removed the signUp button from my layout, android studio does not see it, but when the application starts, it appears.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:backgroundTint="@color/colorPrimaryDark"
android:layout_height="match_parent"
tools:context=".home.MainActivity">
<FrameLayout
android:id="@+id/nav_host_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/roundLayout"/>
<com.github.florent37.shapeofview.shapes.RoundRectView
android:id="@+id/roundLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:elevation="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:shape_roundRect_bottomLeftRadius="22dp"
app:shape_roundRect_bottomRightRadius="22dp"
app:shape_roundRect_topLeftRadius="8dp"
app:shape_roundRect_topRightRadius="8dp">
<com.ismaeldivita.chipnavigation.ChipNavigationBar
android:id="@+id/chipNavigationMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
app:cnb_menuResource="@menu/bottom_menu"/>
</com.github.florent37.shapeofview.shapes.RoundRectView>
</androidx.constraintlayout.widget.ConstraintLayout>
Here is the class code that calls activity_home. After I transferred the activity_home code to another layout, it worked, but immediately hung again and did not change.
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.PersistableBundle
import androidx.fragment.app.Fragment
import cheprasov.egor.cchat.R
import cheprasov.egor.cchat.fragments.favorite.favorites
import cheprasov.egor.cchat.fragments.home.homeFragment
import cheprasov.egor.cchat.fragments.settings.settings
import com.google.firebase.auth.FirebaseAuth
import com.ismaeldivita.chipnavigation.ChipNavigationBar
class MainActivity : AppCompatActivity() {
private lateinit var auth: FirebaseAuth
private lateinit var mAthListner: FirebaseAuth.AuthStateListener
private lateinit var menu: ChipNavigationBar
private var fragment: Fragment? = null
private lateinit var fragmentsHome: Fragment
private lateinit var fragments: Fragment
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_activity)
init()
if(fragment== null){
val transaction = supportFragmentManager.beginTransaction()
fragmentsHome = homeFragment()
transaction.replace(R.id.nav_host_fragment,fragmentsHome)
transaction.commit()
}
menu.setOnItemSelectedListener { id ->
val option = when (id){
R.id.home -> {
fragments = fragmentsHome
setFragment(fragments)
}
R.id.favorited -> {
fragments = favorites()
setFragment(fragments)
}
R.id.settings ->{
fragments = settings()
setFragment(fragments)
}
else -> finish()
}
}
}
private fun setFragment(fragment: Fragment){
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.nav_host_fragment,fragment)
transaction.commit()
}
private fun init(){
auth = FirebaseAuth.getInstance()
menu = findViewById(R.id.chipNavigationMenu)
}
override fun onStop() {
super.onStop()
}
override fun onPause() {
super.onPause()
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
}
override fun onResume() {
super.onResume()
}
override fun onSaveInstanceState(outState: Bundle, outPersistentState: PersistableBundle) {
super.onSaveInstanceState(outState, outPersistentState)
}
override fun onBackPressed() {
super.onBackPressed()
moveTaskToBack(true)
}
private fun signOut(){
auth.signOut()
}
}
[]
[]
[]