RecyclerView skipping layout Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of RecyclerView skipping layout without wasting too much if your time.

The question is published on by Tutorial Guruji team.

When I update the profile in the app the username and the bio update perfectly but the full name doesn’t appear even though they all update in the Firebase database. Also the full name disappears when I save the changes. I believe it’s a linking problem but I am a beginner and don’t know how to fix it. Thanks

private fun updateUserInfoOnly()
{
    when {
        full_name_profile_frag.text.toString() == "" -> {
            Toast.makeText(this, "Full Name is required!", Toast.LENGTH_LONG)
        }
        username_profile_frag.text.toString() == "" -> {
            Toast.makeText(this, "Username is required!", Toast.LENGTH_LONG)
        }
        bio_profile_frag.text.toString() == "" -> {
            Toast.makeText(this, "Please enter your bio first.", Toast.LENGTH_LONG)
        }
        else -> {
            val usersRef = FirebaseDatabase.getInstance().reference.child("Users")

            val userMap = HashMap<String, Any>()
            userMap["full name"] = full_name_profile_frag.text.toString() // YOU CAN REMOVE .toLowerCase
            userMap["username"] = username_profile_frag.text.toString().toLowerCase()
            userMap["bio"] = bio_profile_frag.text.toString()

            usersRef.child(firebaseUser.uid).updateChildren(userMap)

            Toast.makeText(this, "Account information has been updated successfully.", Toast.LENGTH_LONG)

            val intent = Intent(this@AccountSettingsActivity, MainActivity::class.java)
            startActivity(intent)
            finish()
        }
    }

}

profile image

profile edit image

Errors(the app still runs):

E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: AUTHENTICATION_FAILED. Won't retry the operation.

E/RecyclerView: No adapter attached; skipping layout

Answer

I cannot see anywhere in your code the initiliaztion or attachment of Adapter. This means you need to do two things:

1.Set an adapter to your RecyclerView, if not attached already

2.Check whether the data is correctly being bind with the Adapter.

We are here to answer your question about RecyclerView skipping layout - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji