Q:

previous activity's method being called again onBackPress

Screenshot 1 - https://ibb.co/k5O8Eo
Screenshot 2 - https://ibb.co/bz5MZo
Screenshot one is how its supposed to behave and it does behave like that when I open it... but after I open the activity and go to the next activity and come back... the same messages are being fetched again and showing twice although only in the database its only once... how do I solve this problem? 
    @Override
protected void onStart() {
    super.onStart();
    fetchMessages();
}

private void fetchMessages() {
   mDatabaseReference.child("Messages").child(MessageSenderId).child(MessageRecieverId).addChildEventListener(new ChildEventListener() {
        @Override
        public void onChildAdded(DataSnapshot dataSnapshot, String s) {
            Messages message = dataSnapshot.getValue(Messages.class);
            messagesList.add(message);
            mAdapter.notifyDataSetChanged();
        }
        @Override
        public void onChildChanged(DataSnapshot dataSnapshot, String s) {
        }
        @Override
        public void onChildRemoved(DataSnapshot dataSnapshot) {
        }
        @Override
        public void onChildMoved(DataSnapshot dataSnapshot, String s) {
        }
        @Override
        public void onCancelled(DatabaseError databaseError) {
            throw databaseError.toException();
        }
    });
}

A:

It is probably happening because your activity is in backstack and every time you come back the onStart method is called which results in multiple fetches.  
You can clear the list in onStop()
 @Override
 public void onStop(){
 if(messagesList ! = null){
   messageList.clear();
}
}

