title: Signout button in android fragements not working? Kotlin
body: <pre><code>package com.app.myproject.Fragments
  
  import android.content.Intent
  import android.os.Bundle
  import androidx.fragment.app.Fragment
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.util.Log
  import android.widget.Toast
  import androidx.appcompat.app.AppCompatActivity
  import com.app.myproject.LoginActivity
  import com.google.firebase.auth.FirebaseAuth
  import kotlinx.android.synthetic.main.activity_login.*
  
  import com.app.myproject.R
  import com.app.myproject.RegisterActivity
  import kotlinx.android.synthetic.main.fragment_settings.*
  
  
  /**
   * A simple [Fragment] subclass.
   */
  class SettingsFragment : Fragment() {
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? = inflater.inflate(R.layout.fragment_settings, container, false)
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
          view.findViewById(R.id.signout_button).setOnClickListener {
              FirebaseAuth.getInstance().signOut()
              val intent  = Intent(this@SettingsFragment.context, LoginActivity::class.java)
              intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
              startActivity(intent)
  
          }
      }
  }
  
  
  </code></pre>
  
  <p>This is my code. I'm using firebase for the user accounts. I have my settings form in a fragment like this <a href="https://prnt.sc/rvs5yn" rel="nofollow noreferrer">https://prnt.sc/rvs5yn</a></p>
  
  <p>When I click the button signout nothing happens. I was following some code I found on stackoverflow on how to get intent to work on fragments.</p>
  
  <p>Any help would be greatly appreciated. </p>