【发布时间】:2017-05-03 18:43:49
【问题描述】:
我需要从 Push 生成的节点中获取所有存储的数据 这是我的结构:
我所有的节点都向各种 infoWindows 提供数据 像这样:
每个 infoWindow 都包含特定于多个节点的数据,我需要从每个 infoWindows 或特定节点中获取该数据
我需要这些特定数据将它们放入另一个活动中,方法是从节点或 infoWindow 获取数据 我该怎么做?
这是将数据提供给 infoWindow 的代码:
FirebaseUtils.getPostRef().orderByKey().addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(final DataSnapshot dataSnapshot, String s) {
latitud = dataSnapshot.getValue(Post.class).getLatitud();
longitud = dataSnapshot.getValue(Post.class).getLongitud();
titulo = dataSnapshot.getValue(Post.class).getTitulo();
costo = dataSnapshot.getValue(Post.class).getCosto();
mes = dataSnapshot.getValue(Post.class).getMes();
numeroDia = dataSnapshot.getValue(Post.class).getDia();
organizadoPor = dataSnapshot.getValue(Post.class).getOrganizadoPor();
descripcion = dataSnapshot.getValue(Post.class).getDescripicion();
hora = dataSnapshot.getValue(Post.class).getHora();
minutos = dataSnapshot.getValue(Post.class).getMinutos();
BitmapDescriptor bm = BitmapDescriptorFactory.fromResource(R.mipmap.m5);
LatLng latLng1 = new LatLng(latitud, longitud);
mMarker = new MarkerOptions().position(latLng1).title(titulo).snippet(costo).icon(bm);
mp.add(mMap.addMarker(mMarker));
}
我试试这个但它只给了我最后一个 infoWindow 的数据:
Post mPost = new Post();
Intent intent = new Intent(MainActivity.this, OtherActivity.class);
intent.putExtra("abc", mPost):
其他活动:
Intent Intent = getIntent();
mPost = (Post) intent.getSerializableExtra("abc");
【问题讨论】:
标签: android google-maps firebase firebase-realtime-database