我在firebase实时数据库中保存了坐标?如何在android中检索坐标

我在firebase实时数据库中保存了坐标?如何在android中检索坐标,android,firebase,firebase-realtime-database,Android,Firebase,Firebase Realtime Database,因为我已经在firebase实时数据库中保存了所有经过身份验证的用户的坐标。现在我想检索firebase数据库中的所有坐标,以便在地图上显示 就像单一地图上的多个标记一样 这是我将位置发送到firebase的代码 public void onLocationChanged(Location location) { FirebaseUser user = fb.getCurrentUser(); databaseReference.child("L

因为我已经在firebase实时数据库中保存了所有经过身份验证的用户的坐标。现在我想检索firebase数据库中的所有坐标,以便在地图上显示 就像单一地图上的多个标记一样

这是我将位置发送到firebase的代码

 public void onLocationChanged(Location location) {
            FirebaseUser user = fb.getCurrentUser();
            databaseReference.child("Location").child(user.getUid()).child("parth1234").setValue(location.getLatitude() + " , " + location.getLongitude());
        }
现在,我如何将这些位置检索到地图活动中 我已经创建了地图活动,但我不知道与此相关的任何内容 请帮我写一些代码

提前谢谢

我是android studio的初学者


将位置保存到firebase方法中,我使用的方法是否正确???

您的设置正确。
要检索数据,您需要附加一个值侦听器(有关更多信息,请执行以下操作:

FirebaseDatabase.getInstance().getReference("Location").child((user.getUid()).child("parth1234").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
     //Now you can do whatever you want with that location value
     //dataSnapshot.getValue(String.class)
     //I printed it in the code below for you
     System.out.println(dataSnapshot.getValue(String.class));
}

@Override
public void onCancelled(DatabaseError databaseError) {
     //Handle the error
}
});

我不这么认为System.out.println(postSnapshot.getValue(String.class));在Android中可以工作我如何在Android中使用System.out.println将工作你可以在Android研究中看到值我想用标记检索地图上的所有位置?这段代码将如何工作?System.out.println(postSnapshot.getValue(String.class));使用postSnapshot的原因。即将出现错误