use of com.google.firebase.database.DatabaseException in project UniPool by divya21raj.
the class BaseActivity method getUserDetails.
protected void getUserDetails() {
Globals.userDatabaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// whenever data at this location is updated.
try {
if (dataSnapshot.getValue() != null) {
finalCurrentUser = dataSnapshot.getValue(User.class);
UtilityMethods.populateChatMap(dataSnapshot.child("pairUps"));
ReceivedRequestsFragment.refreshRecycler();
SentRequestsFragment.refreshRecycler();
ChatFragment.refreshRecycler();
}
} catch (DatabaseException dbe) {
Toast.makeText(getApplicationContext(), "Some problems, mind restarting the app?", Toast.LENGTH_LONG).show();
}
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Log.w("UserDB", "Failed to read userDB value.", error.toException());
Toast.makeText(getApplicationContext(), "Network Issues!", Toast.LENGTH_SHORT).show();
}
});
bottomNavigationView = findViewById(R.id.bottom_navigation);
bottomNavigationView.setOnNavigationItemSelectedListener(this);
}
Aggregations