As the error message says:
Attempt to invoke virtual method boolean java.lang.String.equals(java.lang.Object) on a null object reference
So you're calling something.equals(...) somewhere, and something is null. The stack trace tells you that the problem is on:
MessageActivity$3.onDataChange(MessageActivity.java:134)
So on line 134 of MessageActivity.java, inside the onDataChange method. While I can't be certain what line 134 is, there is only one onDataChange method in the code you shared, and only one call to equals in there:
reference.addValueEventListener ( new ValueEventListener () {
@Override
public void onDataChange (@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot snapshot:dataSnapshot.getChildren ()){
User user=snapshot.getValue (User.class);
assert user!=null;
assert fuser!=null;
if(!fuser.getUid ().equals ( user.getFirstName () )){
username.setText ( user.getFirstName () );
}
}
readMessages ( fuser.getUid (),userid );
}
So the problem seems to come from this line:
if(!fuser.getUid().equals ( user.getFirstName () )){
Specifically: fuser.getUid() seems to return null, which means you're calling null.equals(...) and that's what the error message says.
It's fairly uncommon for FirebaseAuth.getInstance().getCurrentUser() to return a user object, and then for getUid() to return null, but that does seem to be what's happening for you.