Buggy code:
public class ContactsFragment extends Fragment { public ContactsFragment ( ) { } private ContactsFragment . OnFragmentInteractionListener mListener ; ListView locationsListView ; SharedPreferences preferenceSettings ; String userId = "" ; String displayName = "" ; String mobileNumber = "" ; String profileImageString = "" ; ArrayList < Contacts > contactsArrayList = new ArrayList < Contacts > ( ) ; ArrayList < OnlineReferenceFriends > olf = new ArrayList < OnlineReferenceFriends > ( ) ; ContactsAdapter mAdapter ; String action = "" ; EditText searchEditText ; ProgressDialog ringProgressDialog ; DatabaseHandler dbHandler ; ContactsFragment contactsFragment ; private ContactsFragment . ResponseReceiver receiver ; @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } public void fetchContacts ( ) { } public class CustomComparator implements Comparator < Contacts > { @ Override public int compare ( Contacts o1 , Contacts o2 ) { } } public void sendLocation ( Contacts item ) { } public void chat ( Contacts item ) { } public void sendSavedLocation ( Contacts item ) { } public void requestLocation ( Contacts item ) { } public void addFriend ( Contacts item ) { } @ Override public void onResume ( ) { super . onResume ( ) ; Tracker t = FetchMeThere . getInstance ( ) . tracker ; t . setScreenName ( "Contacts" ) ; t . send ( new HitBuilders . ScreenViewBuilder ( ) . build ( ) ) ; if ( ( dbHandler . getContactsCount ( ) ) > 0 ) { contactsArrayList = dbHandler . getAllContacts ( ) ; Collections . sort ( contactsArrayList , new ContactsFragment . CustomComparator ( ) ) ; mAdapter = new ContactsAdapter ( getActivity ( ) , contactsArrayList , action , this ) ; locationsListView . setAdapter ( mAdapter ) ; mAdapter . mHighlightedPositions = new boolean [ contactsArrayList . size ( ) ] ; mAdapter . notifyDataSetChanged ( ) ; } else { ringProgressDialog = ProgressDialog . show ( getActivity ( ) , "Please<seq2seq4repair_space>wait<seq2seq4repair_space>..." , "Finding<seq2seq4repair_space>Friends..." , true ) ; ringProgressDialog . setCancelable ( true ) ; final Firebase ref = new Firebase ( Constants . BASE_URL ) ; Firebase postRef = ref . child ( "users" ) . child ( userId ) . child ( "friends" ) ; <START_BUG> postRef . addValueEventListener ( new ValueEventListener ( ) { <END_BUG> @ Override public void onDataChange ( DataSnapshot snapshot ) { System . out . println ( snapshot ) ; olf . clear ( ) ; for ( DataSnapshot child : snapshot . getChildren ( ) ) { OnlineReferenceFriends ol = new OnlineReferenceFriends ( ) ; for ( DataSnapshot mChild : child . getChildren ( ) ) { if ( mChild . getKey ( ) . equalsIgnoreCase ( "userId" ) ) { ol . setUserId ( mChild . getValue ( ) . toString ( ) ) ; } else if ( mChild . getKey ( ) . equalsIgnoreCase ( "name" ) ) { ol . setName ( mChild . getValue ( ) . toString ( ) ) ; } else if ( mChild . getKey ( ) . equalsIgnoreCase ( "mobile" ) ) { ol . setMobile ( mChild . getValue ( ) . toString ( ) ) ; } else if ( mChild . getKey ( ) . equalsIgnoreCase ( "profileImageString" ) ) { ol . setProfileImageString ( mChild . getValue ( ) . toString ( ) ) ; } } olf . add ( ol ) ; } fetchContacts ( ) ; Collections . sort ( contactsArrayList , new ContactsFragment . CustomComparator ( ) ) ; mAdapter . mHighlightedPositions = new boolean [ contactsArrayList . size ( ) ] ; mAdapter . notifyDataSetChanged ( ) ; ringProgressDialog . dismiss ( ) ; } @ Override public void onCancelled ( FirebaseError firebaseError ) { System . out . println ( ( "The<seq2seq4repair_space>read<seq2seq4repair_space>failed:<seq2seq4repair_space>" + ( firebaseError . getMessage ( ) ) ) ) ; } } ) ; } } public class ResponseReceiver extends BroadcastReceiver { public static final String ACTION_RESP = "com.mamlambo.intent.action.MESSAGE_PROCESSED" ; @ Override public void onReceive ( Context context , Intent intent ) { } } @ Override public void onAttach ( Activity activity ) { } @ Override public void onDetach ( ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } public interface OnFragmentInteractionListener { public void onActionAddLocation ( ) { } public void onSendLocationToFriend ( String friendId , String friendName , String friendProfileImageString , double lat , double lang ) { } public void onChatToFriend ( String friendId , String friendName , String friendProfileImageString ) { } public void onRequestLocation ( String friendId , String friendName , String profileImageView ) { } public void onLocationSent ( String friendName , String locationName ) { } } }

Fix:
postRef . addListenerForSingleValueEvent ( new ValueEventListener ( ) {