If I use a listener in action as follows:
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String value = dataSnapshot.getValue(String.class);
Log.d(TAG, "Value is: " + value);
}
@Override
public void onCancelled(DatabaseError error) {
Log.w(TAG, "Failed to read value.", error.toException());
}
});
Attaching an anonymous listener (an event that is not bound to a variable), do I still need to delete it?
* I install this on onStart()and need it to run before onStop()/onDestroy()
When do I need to remove a listener?
source
share