0

Because of this two line my app is getting terminated

    sName = findViewById(R.id.user_name)
    sName.text = name

the complete code

//Write your code here
    mAuth = FirebaseAuth.getInstance()

    //display profile information such as profile_image, name, email account
    val user = mAuth.currentUser
    profileImage = user?.photoUrl.toString()
    name = user?.displayName.toString()
    email = user?.email.toString()

    Log.e("DisplayName", name)
    Log.e("Profile_url", profileImage)
    Log.e("Email", email)

What can be the solution for this

  • 1
    stacktrace please? – Faisal Naseer May 18 '22 at 12:44
  • try `name = user?.displayName ?: "unknown"` – Faisal Naseer May 18 '22 at 12:46
  • 1
    Are you sure that the user is authenticated? – Alex Mamo May 18 '22 at 12:51
  • When an app crashes, it writes an error message and stack trace to its logcat. Please find those, and add them to your question by clicking the `edit` link under it. Also see https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this and https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors – Frank van Puffelen May 18 '22 at 13:22
  • Please edit your question and add the information Frank asked for, and please also respond with @. – Alex Mamo May 19 '22 at 06:02

0 Answers0