数据:- products - -L74Pc7oVY22UsCETFBv - name: "gjwj" - category: "hreggrrg" - location: "vjhiwehifwe" - price: 44 - color: fassaf - -L74uJ7oVYcVNyCteFBz - name: "uygfwh" - category: "hhhjwwwom" - location: "pervrr" - price: 33 - color: yrtrr ......................我在node中有很多产品products,超过1000种产品。我可以在中显示所有内容ListView。我只想向用户显示一个唯一的随机变量,例如高亮显示,而不是全部下载,仅下载一个。码:ValueEventListener v = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for(DataSnapshot child : dataSnapshot.getChildren()) { String name = (String) child.child("name").getValue().toString(); Toast.makeText(MainActivity.this, name, Toast.LENGTH_SHORT).show(); //How to get????? } } @Override public void onCancelled(DatabaseError databaseError) {}};FirebaseDatabase.getInstance().getReference().addListenerForSingleValueEvent(v);如何在节点Firebase中获得唯一的随机产品?
添加回答
举报
0/150
提交
取消