파이어베이스에 여러 유저들이 있고 그 유저들이 각각 가지고 있는 데이터 들을 모두 가져오려합니다.
아래 코드로 진행해보았지만 아무런 값이 나오지 않습니다. 어떤게 문제인지 지적해주실 수 있나요?
DatabaseReference myRef = database.getReference("users");
myRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
LocationList mfriendLocation = dataSnapshot.getValue(LocationList.class);
friendLocation.add(mfriendLocation);
for(int i = 0 ; i < friendLocation.size(); i++){
LocationList newFriendLoaction = new LocationList();
newFriendLoaction.setEmail(friendLocation.get(i).email);
newFriendLoaction.setsLatitude(friendLocation.get(i).sLatitude);
newFriendLoaction.setsLongitude(friendLocation.get(i).sLongitude);
newFriendLoaction.setdLatitude(friendLocation.get(i).dLatitude);
newFriendLoaction.setdLatitude(friendLocation.get(i).dLatitude);
stOtherUser = newFriendLoaction.getEmail();
makeText(getActivity(),stOtherUser,Toast.LENGTH_SHORT).show();
slatitude = newFriendLoaction.getsLatitude();
slongitude = newFriendLoaction.getsLongitude();
dlatitude = newFriendLoaction.getdLatitude();
dlongitude = newFriendLoaction.getdLongitude();
stSLocation = GetAddress(geocoder,slatitude,slongitude);
stDLocation = GetAddress(geocoder,dlatitude,dlongitude);
setOthersCurrentLocation(slatitude,slongitude,stOtherUser,"",stSLocation,stDLocation,newFriendLoaction.email);
}
}
}