Problem is when I use this code for increment specific value in database it increment all values
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { for (DataSnapshot dataSnapshot: snapshot.getChildren()) { id = dataSnapshot.getKey(); Long count = snapshot.child(id).child("count").getValue(Long.class); databaseReference.child(id).child("count").setValue(count + 1); Toast.makeText(Raees_At7ad.this, "تم التصويت", Toast.LENGTH_SHORT).show(); } } I have recyclerView has some items I want increment specific count when click on one item, but it increment all count in database

没有评论:
发表评论