Created
November 29, 2017 12:27
-
-
Save metes/f9f6b849a35eee0d20776ce0361e5fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addListenerForChatRoomStillExits() { | |
String currentUserId = SessionManager.getInstance().getString(Constant.FIREBASE_CURRENT_USER_ID); | |
userDatabase.child("users").child(currentUserId).child("conversations").orderByChild("isAccepted").equalTo(true).addValueEventListener(new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
boolean isRoomExits = false; | |
if (dataSnapshot.exists()) { | |
for (DataSnapshot data : dataSnapshot.getChildren()) { | |
Object object = data.getValue(); | |
HashMap lastMap = (HashMap) object; | |
if (lastMap.get("location").equals(location)) { | |
isRoomExits = true; | |
break; | |
} | |
//... | |
} | |
} | |
if (!isRoomExits) { | |
Toast.makeText(getBaseContext(), "room deleted", Toast.LENGTH_LONG).show(); | |
} | |
} | |
@Override | |
public void onCancelled(DatabaseError databaseError) { | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment