-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProfileActivity.kt
38 lines (30 loc) · 1.13 KB
/
ProfileActivity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example.emitracker
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.auth.FirebaseAuth
class ProfileActivity : AppCompatActivity() {
private lateinit var auth: FirebaseAuth
private lateinit var emailTextView: TextView
private lateinit var signOutButton: Button
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_profile)
auth = FirebaseAuth.getInstance()
emailTextView = findViewById(R.id.emailTextView)
signOutButton = findViewById(R.id.signOutButton)
val currentUser = auth.currentUser
if (currentUser != null) {
emailTextView.text = currentUser.email
} else {
emailTextView.text = "No user found."
}
signOutButton.setOnClickListener {
auth.signOut()
startActivity(Intent(this, MainActivity::class.java))
finish()
}
}
}