Following is the code and on one of the line, android studio is asking me to declare as final
public void getFullName(GetFullNameCallback getFullNameCallback) { usersRef.child(mAuth.getUid()).child("fN").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
getFullNameCallback.onCallback(dataSnapshot.getValue().toString());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {}
});
}
private interface GetFullNameCallback {
void onCallback(String fullName);
}
At the getFullNameCallback.onCallback()
in onDataChange
, it is underlined red as it says getFullNameCallback
should be declared final but according to this answer, it is just fine??