1 year ago
#329203
Kalyan Mishra
E/ActivityTrigger: activityResumeTrigger: not whiteListed Error (kotlin- android)
In kotlin I am making app to signUp, Login and then after successfull signIn user will be forwarded to home screen
where all users will be displayed, So I am fetching data from database to show in the recyclerView and getting this error :(
please help.
2022-03-24 10:38:46.835 9086-6305/? V/FA-SVC: Logging event: origin=auto,name=user_engagement(_e),params=Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=11817, ga_screen_class(_sc)=SignUp, ga_screen_id(_si)=5165931126923283161}]
2022-03-24 10:38:46.925 2079-3402/? E/ActivityTrigger: activityResumeTrigger: not whiteListedcom.example.chatplusapp/com.example.chatplusapp.SignUp/1
2022-03-24 10:38:46.925 2079-3402/? E/ActivityTrigger: activityResumeTrigger: not whiteListedcom.example.chatplusapp/com.example.chatplusapp.SignUp/1
2022-03-24 10:38:56.753 9086-6305/? V/FA-SVC: Logging event: origin=auto,name=user_engagement(_e),params=Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=9550, ga_screen_class(_sc)=SignUp, ga_screen_id(_si)=5165931126923283161}]
2022-03-24 10:38:56.772 9086-6305/? V/FA-SVC: Logging event: origin=auto,name=screen_view(_vs),params=Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=SignUp, ga_previous_id(_pi)=5165931126923283161, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=5165931126923283162}]
Here is my main activity code where fetch and display user data details into recyclerView adapter code is there.
package com.example.chatplusapp
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.*
class MainActivity : AppCompatActivity() {
private lateinit var userRecyclerView: RecyclerView
private lateinit var userList: ArrayList<User>
private lateinit var adapter: UserAdapter
private lateinit var mAuth: FirebaseAuth
private lateinit var mDbRef: DatabaseReference
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
mAuth= FirebaseAuth.getInstance()
mDbRef= FirebaseDatabase.getInstance().getReference()
userList= ArrayList()
adapter= UserAdapter(this, userList)
userRecyclerView= findViewById(R.id.userRecyclerView)
userRecyclerView.layoutManager= LinearLayoutManager(this)
userRecyclerView.adapter= adapter
//read the value from the database
mDbRef.child("user").addValueEventListener(object : ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
userList.clear()
//snapshot is use to get how schema of the database is
for (postSnapshot in snapshot.children) {
//create user object and add it to the user list
val currentUser = postSnapshot.getValue(User::class.java)
//if current user is there then dont display that to the list
if(mAuth.currentUser?.uid!=currentUser?.uid){
userList.add(currentUser!!)
}
}
adapter.notifyDataSetChanged()
}
override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}
})
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_item, menu)
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if(item.itemId==R.id.logout){
//write the code for sign-out
mAuth.signOut()
startActivity(Intent(this@MainActivity, LogIn::class.java))
finish()
return true
}
return true
}
}
android
firebase
android-studio
kotlin
kotlin-android
0 Answers
Your Answer