I tried to retrieve data from Firebase using the childeventlistener. I have seen all the methods available on stackoverflow to resolve the difficulty but nothing worked.Code is given below
ViewModel
class AccepyReqViewModel : ViewModel() {
companion object {
const val TAG = "AcceptViewModel"
}
private val _userdetail = MutableLiveData<User>()
val userdetail: LiveData<User>
get() = _userdetail
private val userid = FirebaseAuth.getInstance().currentUser?.uid
private val chatrequest = "CHATREQ"
private val db_chat = FirebaseDatabase.getInstance().getReference(chatrequest)
private val company_info = "User_Info"
private val db_company = FirebaseDatabase.getInstance().getReference(company_info)
private val reqchildeventlister = object : ChildEventListener {
override fun onCancelled(error: DatabaseError) {}
override fun onChildMoved(snapshot: DataSnapshot, p1: String?) {
}
override fun onChildChanged(snapshot: DataSnapshot, p1: String?) {
}
override fun onChildAdded(snapshot: DataSnapshot, p1: String?) {
val getid = snapshot.getValue(Request::class.java)
val id = getid!!.id
val requesttype = getid.requesttype
Log.d(TAG, "Second function to be called")
Log.d(TAG, "$requesttype request type")
id?.let { getDetails(it) }
Log.d(TAG, "$id ID passed")
}
override fun onChildRemoved(snapshot: DataSnapshot) {
}
}
fun getRequest() {
Log.d(TAG, "getRequest method called 1st fun")
db_chat.child(userid!!).addChildEventListener(reqchildeventlister)
}
fun getDetails(id: String) {
Log.d(TAG, "Second function called")
db_company.child(id).addChildEventListener(datachildeventlistener)
}
private val datachildeventlistener = object : ChildEventListener {
override fun onCancelled(error: DatabaseError) {
}
override fun onChildMoved(snapshot: DataSnapshot, p1: String?) {
}
override fun onChildChanged(snapshot: DataSnapshot, p1: String?) {
Log.d(TAG, "onChildChanged")
val data = snapshot.getValue(User::class.java)
data?.id = snapshot.key
_userdetail.value = data
}
override fun onChildAdded(snapshot: DataSnapshot, p1: String?) {
val data = snapshot.getValue(User::class.java)
data?.id = snapshot.key
_userdetail.value = data
}
override fun onChildRemoved(snapshot: DataSnapshot) {
}
}
}
The Model Class is as follows
import com.google.firebase.database.Exclude
data class User(
#get:Exclude
var id: String? = null,
var isAdmin: Boolean? = true,
var name: String? = null,
var position: String? = null,
var contact: String? = null,
var comname: String? = null,
var address: String? = null,
var email: String? = null,
var website: String? = null
) {
constructor() : this("", true, "", "", "", "", "", "", "")
}
Firebase Realtime Database looks as follows
CHATREQ
8EFvXhAKTfWuIavGhXlz344bgMD2
c2HUyNV6sYQImIFqVNMfIaFDTKT2
id: "c2HUyNV6sYQImIFqVNMfIaFDTKT2"
request_type: "sent"
c2HUyNV6sYQImIFqVNMfIaFDTKT2
8EFvXhAKTfWuIavGhXlz344bgMD2
id: "8EFvXhAKTfWuIavGhXlz344bgMD2"
request_type: "received"
Company_Info
-M6Ez9RiFRpm8_cn35Pp
User_Info
8EFvXhAKTfWuIavGhXlz344bgMD2
admin: false
contact: "484615674"
name: "Chetan"
position: "c"
c2HUyNV6sYQImIFqVNMfIaFDTKT2
address: "add"
admin: true
comname: "Palekar"
contact: "549874561"
email: "add#gmail.com"
name: "Kp"
position: "adfa"
website: "www.add.com"
The stacktrace said that "cant convert object of string to the user Model class"
Hope Someone help me out with this .
Thank-You for your help.
Instead of using childEventListener, you need to use valueEventListener:
private val company_info = "User_Info"
private val db_company = FirebaseDatabase.getInstance().getReference(company_info)
private val reqEventlister = object : ValueEventListener {
override fun onCancelled(error: FirebaseError?) {
println(error!!.message)
}
override fun onDataChange(snapshot: DataSnapshot?) {
val getid = snapshot.getValue(Request::class.java)
val id = getid!!.id
val requesttype = getid.requesttype
Log.d(TAG, "Second function to be called")
Log.d(TAG, "$requesttype request type")
id?.let { getDetails(it) }
Log.d(TAG, "$id ID passed")
}
})
fun getRequest() {
Log.d(TAG, "getRequest method called 1st fun")
db_chat.child(userid!!).addValueEventListener(reqEventlister)
}
When using childEventListener, you are directly retrieving the children under the 8EFvXhAKTfWuIavGhXlz344bgMD2 thus retrieving values of type String. Instead you need to use ValueEventListener which will map your Request class to the data retrieved.
Related
my connecter:
interface SettingsVMRepConnector {
fun getUserEmail(email: String)
}
in my viewmodel:
class MyViewModel: ViewModel(), SettingsVMRepConnector
{
private val repository= SettingsRepository(this)
private var inputUserEmail= MutableLiveData<String?>()
fun getInputUserEmail(): LiveData<String?> {return inputUserEmail}
...
init{
repository.findUserEmail()
}
override fun getUserEmail(email:String) {
inputUserEmail.value = email
println(inputUserEmail.value.toString()+"...")
}
}
in my fragment:
val email : String = viewModel.getInputUserEmail().value.toString()
println("here: "+email)
emailInput.setText(email)
and in repository:
class SettingsRepository(val connector: SettingsVMRepConnector){
private val userID= Hawk.get<String>(Constants.LOGGEDIN_USERID)
private val usersRef: DatabaseReference = FirebaseDatabase.getInstance().getReference().child("Users")
fun findUserEmail(){
usersRef.child(userID).addValueEventListener(object : ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
var email = snapshot.child(Constants.R_USEREMAIL).value.toString()
connector.getUserEmail(email)
return
}
override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}
})
}
}
output is:
here: null
james#gmail.com...
I want to see this email in fragment. Why is returns null? And how can I see this e mail in my fragment?
Database Structure
I have the database structure shown in the image,
and I am using the following reference to retrieve the child values.
private fun readNotificationComments() {
val notifRef = FirebaseDatabase.getInstance().reference
.child("Notifications")
.child(FirebaseAuth.getInstance().currentUser!!.uid)
.child("Comments")
.child(/*unknown child*/)
notifRef.addValueEventListener(object : ValueEventListener{
override fun onDataChange(dataSnapshot: DataSnapshot) {
if(dataSnapshot.exists()){
(notificationList as ArrayList<Notification>).clear()
for(snapshot in dataSnapshot.children)
{
val notification = snapshot.getValue(Notification::class.java)
(notificationList as ArrayList<Notification>).add(notification!!)
}
Collections.reverse(notificationList);
notificationAdapter!!.notifyDataSetChanged()
refresh = true
swipe_refresh_comments.isRefreshing = false
}
}
override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}
})
}
Now my problem is that the value "-MYxVs5l5bmRA-rf9PSt" is unknown and created randomly, how to make changes so that it the function looks for data past that unknown child value?
This is the model class
class Notification
{
private var userid: String = ""
private var text: String = ""
private var postid: String = ""
private var ispost: Boolean = false
constructor()
constructor(userid: String, text: String, postid: String, ispost: Boolean) {
this.userid = userid
this.text = text
this.postid = postid
this.ispost = ispost
}
fun getUserId(): String
{
return userid
}
fun setUserId(userid: String)
{
this.userid = userid
}
fun getPostId(): String
{
return postid
}
fun setPostId()
{
this.postid = postid
}
fun getText(): String
{
return text
}
fun setText(text: String)
{
this.text = text
}
fun getIsPost(): Boolean
{
return ispost
}
fun setIsPost(ispost: Boolean)
{
this.ispost = ispost
}
}
I got a problem and I can't see an error in my code, maybe You'll help me. I've got an application in Android Studio that uses connection with Firebase. I add products to the database by a button and in the activity that holds RecycleViever, it lists that product there. The problem is that RecycleViewer shows nothing, even though that my button adds product to the Firebase. That RecycleViewer should list products from Firebase. I add product with It's structure:
data class Product(var name: String, var price: Double, var quantity: Long, var bought: Boolean) {
var id: String = ""
companion object {
fun fromContentValues(values: ContentValues?): Product {
values?.let{
return Product(
values.getAsString("name"),
values.getAsDouble("price"),
values.getAsLong("amount"),
values.getAsBoolean("bought"))
} ?: throw IllegalArgumentException()
}
}
#Exclude
fun toMap(): Map<String, Any?> {
return mapOf(
"id" to id,
"name" to name,
"price" to price,
"quantity" to quantity,
"bought" to bought
)
}
}
Product Repository:
class ProductRepository(private val dbRef: DatabaseReference) {
fun insert(product: Product) {
val key = dbRef.push().key
if (key == null) {
Log.w("error", "Couldn't get push key for posts")
return
}
product.id = key
val productValues = product.toMap()
val childUpdates = hashMapOf<String, Any>(
key to productValues
)
dbRef.updateChildren(childUpdates)
}
fun update(product: Product){
val productValues = product.toMap()
val childUpdates = hashMapOf<String, Any>(
product.id to productValues
)
dbRef.updateChildren(childUpdates)
}
fun delete(key: String){
dbRef.child(key).removeValue()
}
}
Product ViewModel:
class ProductViewModel(app: Application) : AndroidViewModel(app) {
private val repo: ProductRepository
val allProducts: MutableList<Product>
init {
allProducts = arrayListOf()
val database = FirebaseDatabase.getInstance()
val reference : DatabaseReference = database.getReference("database/products")
var name: String
var price: Double
var amount: Long
var bought: Boolean
reference.addValueEventListener(object : ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
for (product in snapshot.children) {
name = product.child("name").value as String
price = product.child("price").value as Double
amount = product.child("amount").value as Long
bought = product.child("bought").value as Boolean
val newProduct = Product(name, price, amount, bought)
allProducts.add(newProduct)
}
}
override fun onCancelled(error: DatabaseError) {
Log.w("error", "loadPost:onCancelled", error.toException())
}
})
repo = ProductRepository(reference)
}
fun insert(product: Product) {
repo.insert(product)
}
fun update(product: Product) {
repo.update(product)
}
fun delete(product: Product) {
repo.delete(product.id)
}
}
My Adapter:
class ProductsAdapter(val productViewModel: ProductViewModel) : RecyclerView.Adapter<ProductsAdapter.ViewHolder>() {
private var products = mutableListOf<Product>()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProductsAdapter.ViewHolder {
val inflater = LayoutInflater.from(parent.context)
val view = ListElementBinding.inflate(inflater)
return ViewHolder(view)
}
override fun onBindViewHolder(holder: ProductsAdapter.ViewHolder, position: Int) {
val currentProduct = products[position]
holder.binding.rvTv1.text = currentProduct.name
holder.binding.rvTv2.text = currentProduct.price.toString()
holder.binding.rvTv3.text = currentProduct.amount.toString()
holder.binding.rvCb1.isChecked = currentProduct.bought
holder.binding.bted.setOnClickListener {
currentProduct.name = holder.binding.rvTv1.text.toString()
currentProduct.price = holder.binding.rvTv2.text.toString().toDouble()
currentProduct.amount = holder.binding.rvTv3.text.toString().toLong()
currentProduct.bought = holder.binding.rvCb1.isChecked
productViewModel.update(currentProduct)
}
holder.binding.btdel.setOnClickListener {
productViewModel.delete(currentProduct)
products.remove(currentProduct)
notifyDataSetChanged()
}
}
override fun getItemCount(): Int = products.size
inner class ViewHolder(val binding: ListElementBinding) : RecyclerView.ViewHolder(binding.root)
fun setProducts() {
this.products = productViewModel.allProducts
notifyDataSetChanged()
}
fun addProduct(product: Product) {
productViewModel.insert(product)
notifyDataSetChanged()
}
}
And finally activity that Lists it all:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityListBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.rv1.layoutManager = LinearLayoutManager(baseContext)
binding.rv1.addItemDecoration(DividerItemDecoration(baseContext, DividerItemDecoration.VERTICAL))
val productViewModel = ProductViewModel(this.application)
binding.rv1.adapter = ProductsAdapter(productViewModel)
(binding.rv1.adapter as ProductsAdapter).setProducts()
binding.bt5.setOnClickListener() {
val name = et1.text.toString()
val price = et3.text.toString().toDouble()
val amount = et2.text.toString().toLong()
val bought = false
val product = Product(name, price, amount, bought)
(binding.rv1.adapter as ProductsAdapter).addProduct(product)
et1.text.clear()
et2.text.clear()
et3.text.clear()
}
binding.rv1.adapter = ProductsAdapter(productViewModel)
}
}
I literally have no idea, why it's not showing anything. Maybe You can help me.
I am trying to build a chatting application but whenever I click on the any of the users it crashes.
class MessegeActivity : AppCompatActivity() {
var userIdVisit: String = ""
var currentUserId : FirebaseUser?=null
var chatsAdpater:ChatAdpater?=null
var mChatList:List<Chat>?=null
lateinit var recycler_view_chat:RecyclerView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_messege)
intent = intent
userIdVisit = intent.getStringExtra("visit_id")
currentUserId =FirebaseAuth.getInstance().currentUser!!
recycler_view_chat =findViewById(R.id.recycler_view_chat)
recycler_view_chat.setHasFixedSize(true)
var linearLayoutManager =LinearLayoutManager(applicationContext)
linearLayoutManager.stackFromEnd =true
recycler_view_chat.layoutManager =linearLayoutManager
//showing other username and profile dp
val reference = FirebaseDatabase.getInstance().reference
.child("Users").child(userIdVisit)
reference.addValueEventListener(object : ValueEventListener {
override fun onDataChange(p0: DataSnapshot) {
val user: Users? = p0.getValue(Users::class.java)
username_mchat.text = user!!.getFullName()
Picasso.get().load(user.getImg()).into(profile_image_mchat)
retreiveMsg(currentUserId!!.uid,userIdVisit,user.getImg())
}
override fun onCancelled(error: DatabaseError) {
}
})
send_messege_btn.setOnClickListener {
val messege = text_messege.text.toString()
if (messege == "") {
Toast.makeText(this#MessegeActivity, "Please write something!!", Toast.LENGTH_SHORT)
.show()
} else {
sendMessegeToUser(currentUserId!!.uid, userIdVisit, messege)
}
text_messege.setText("")
}
attach_image_file.setOnClickListener {
val intent = Intent()
intent.action = Intent.ACTION_GET_CONTENT
intent.type = "image/*"
startActivityForResult(Intent.createChooser(intent, "Pick Image"), 198)
}
}
private fun sendMessegeToUser(senderId: String, receiverId: String?, messege: String) {
val reference = FirebaseDatabase.getInstance().reference
val messegeKey:String = reference.push().key!!
val messegeHashMap = HashMap<String, Any?>()
messegeHashMap["sender"] = senderId
messegeHashMap["messege"] = messege
messegeHashMap["receiver"] = receiverId
messegeHashMap["isseen"] = "false"
messegeHashMap["url"] = ""
messegeHashMap["messegeId"] = messegeKey
reference.child("Chats").child(messegeKey).setValue(messegeHashMap)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
val ChatsListRefernce =
FirebaseDatabase.getInstance().reference.child("ChatLists").child(currentUserId!!.uid).child(userIdVisit)
ChatsListRefernce.addListenerForSingleValueEvent(object :ValueEventListener{
override fun onDataChange(p0: DataSnapshot) {
if(!p0.exists())
{
ChatsListRefernce.child("id").setValue(userIdVisit)
}
val ChatsListReceiverRefernce =
FirebaseDatabase.getInstance().reference.child("ChatLists").child(userIdVisit).child(currentUserId!!.uid)
ChatsListReceiverRefernce.child("id").setValue(currentUserId!!.uid)
}
override fun onCancelled(error: DatabaseError) {
}
})
//notification
// val reference = FirebaseDatabase.getInstance().reference
// .child("Users").child(currentUserId!!.uid)
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 198 && resultCode ==RESULT_OK && data!=null && data.data != null) {
val progressBar = ProgressDialog(this)
progressBar.setMessage("Please wait")
progressBar.show()
val fileUri = data.data
val storageRef = FirebaseStorage.getInstance().reference.child("Chat Images")
val ref = FirebaseDatabase.getInstance().reference
val messegeId = ref.push().key
val filepath = storageRef.child("$messegeId.jpg")
var uploadTask: StorageTask<*>
uploadTask = filepath.putFile(fileUri!!)
uploadTask.continueWithTask(Continuation<UploadTask.TaskSnapshot, Task<Uri>> { task ->
if (!task.isSuccessful) {
task.exception?.let {
throw it
}
}
return#Continuation filepath.downloadUrl
}).addOnCompleteListener { task ->
val downloadUrl = task.result
val url = downloadUrl.toString()
val messegeHashMap = HashMap<String,Any?>()
messegeHashMap["sender"] = currentUserId!!.uid
messegeHashMap["messege"] = "sent you an image"
messegeHashMap["receiver"] = userIdVisit
messegeHashMap["isseen"] = "false"
messegeHashMap["url"] = url
messegeHashMap["messegeId"] = messegeId.toString()
ref.child("Chats").child(messegeId!!).setValue(messegeHashMap)
progressBar.dismiss()
}
}
}
private fun retreiveMsg(senderId: String, receiverId: String?, recieverimgUrl: String?) {
mChatList =ArrayList()
val reference =FirebaseDatabase.getInstance().reference.child("Chats")
reference.addValueEventListener(object:ValueEventListener{
override fun onDataChange(p0: DataSnapshot) {
(mChatList as ArrayList<Chat>).clear()
for (snapshot in p0.children)
{
val chat= snapshot.getValue(Chat::class.java)
if(chat!!.getReceiver().equals(senderId)&& chat.getSender().equals(receiverId) ||
chat.getReceiver().equals(receiverId)&& chat.getSender().equals(senderId))
{
(mChatList as ArrayList<Chat>).add(chat)
}
chatsAdpater = ChatAdpater(this#MessegeActivity,(mChatList as ArrayList<Chat>),recieverimgUrl!!)
recycler_view_chat.adapter =chatsAdpater
}
}
override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}
})
}
}
package com.insidecoderz.trails2.Model
class Chat {
private var sender:String =""
private var messege:String =""
private var receiver:String =""
private var isseen :Boolean= false
private var url:String =""
private var messegeId:String =""
constructor()
constructor(
sender: String,
messege: String,
receiver: String,
isseen:Boolean,
url: String,
messegeId: String
) {
this.sender = sender
this.messege = messege
this.receiver = receiver
this.isseen = isseen
this.url = url
this.messegeId = messegeId
}
fun getSender(): String?{
return sender
}
fun setSender(sender: String){
this.sender =sender
}
fun getMessege(): String?{
return messege
}
fun setMessege(messege: String){
this.messege =messege
}
fun getReceiver(): String?{
return receiver
}
fun setReceiver(receiver: String){
this.receiver =receiver
}
fun isIsSeen(): Boolean {
return isseen
}
fun setIsSeen(isseen: Boolean){
this.isseen =isseen
}
fun getUrl(): String?{
return url
}
fun setUrl(url: String){
this.url =url
}
fun getMessegeId(): String?{
return messegeId
}
fun setMessegeId(messegeId: String){
this.messegeId =messegeId
}
}
I am facing this issue again and again, whenever I run the application in the application in the emulator it crashes with showing this error.
2020-08-22 23:19:59.920 17005-17005/com.insidecoderz.trails2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.insidecoderz.trails2, PID: 17005
com.google.firebase.database.DatabaseException: Can't convert object of type java.lang.Boolean to type com.insidecoderz.trails2.Model.Chat
at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.convertBean(CustomClassMapper.java:435)
at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.deserializeToClass(CustomClassMapper.java:231)
at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.convertToCustomClass(CustomClassMapper.java:79)
at com.google.firebase.database.DataSnapshot.getValue(DataSnapshot.java:203)
at com.insidecoderz.trails2.MessegeActivity$retreiveMsg$1.onDataChange(MessegeActivity.kt:202)
at com.google.firebase.database.core.ValueEventRegistration.fireEvent(ValueEventRegistration.java:75)
at com.google.firebase.database.core.view.DataEvent.fire(DataEvent.java:63)
at com.google.firebase.database.core.view.EventRaiser$1.run(EventRaiser.java:55)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7134)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
If you access the id of the user with the following code val reference = FirebaseDatabase.getInstance().reference.child("Users").child(userIdVisit) and then you try to get the data as a model Chat you can not do that, instead try FirebaseDatabase.getInstance().reference.child("Users").This way you'll be able to get your data as model Chat but it won't be the id you want, also if at the node "Users" you have more users then you'll obtain all the users info using the model Chat
If you need the information for the userIdVisit then you can you do the following
snapshot.child("userInfo1").getValue();
snapshot.child("userInfo2").getValue();
This is the sample for java, you should adapt it for kotlin, I'm sorry for not providing the sample in kotlin but I'm not familiar with it
i have data where there is image post and description
when i retrieve the data it shows error toast,
can't find whats wrong here is my code
class MainActivity : AppCompatActivity() {
val ref = FirebaseDatabase.getInstance().getReference("post")
var storageRef = FirebaseStorage.getInstance().reference
private val TAG = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val recyclerView = findViewById<RecyclerView>(R.id.DrawerId)
recyclerView.layoutManager = LinearLayoutManager(this, LinearLayout.VERTICAL,false)
val users = ArrayList<RecyClass>()
val userlist = ArrayList<RecyClass>()
ref.addChildEventListener(object :ChildEventListener{
override fun onCancelled(p0: DatabaseError?) {
Log.e(TAG ,"Error is here")
}
override fun onChildMoved(p0: DataSnapshot?, p1: String?) {}
override fun onChildChanged(p0: DataSnapshot?, p1: String?) {}
override fun onChildAdded(p0: DataSnapshot?, p1: String?) {
if(p0!!.exists()){
for (h in p0.children) {
getpost(h.key)
}
}
}
override fun onChildRemoved(p0: DataSnapshot?) {}
})
}
private fun getpost(key: String?) {
val postdata = FirebaseDatabase.getInstance().getReference("post").child(key)
postdata.addListenerForSingleValueEvent(object:ValueEventListener{
override fun onCancelled(p0: DatabaseError?) {
}
override fun onDataChange(p0: DataSnapshot?) {
if(p0!!.exists()){
val userlist = ArrayList<RecyClass>()
var descText = ""
var Image = ""
if (p0.child("desc").getValue()!=null){
descText = p0.child(key).child("desc").getValue().toString()
}
if (p0.child("Image").getValue()!=null){
Image = p0.child(key).child("Image").getValue().toString()
}
val kkk = RecyClass(descText,Image)
val adptr =RecyclerAdapter(userlist,applicationContext )
userlist.add(kkk)
adptr.notifyDataSetChanged()
}else{
Toast.makeText(this#MainActivity,"error",Toast.LENGTH_LONG).show()
}
}
}
})
}
i already have multiple data inside firebase node
when i put toast inside if(p0!!.exists()) it shows but when toast is moved inside if (p0.child("desc").getValue()!=null) it dhoesnt work..
i am getting blank page in recycler view