我可以使用此代码从firebase获取我的用户列表;
Query query = FirebaseDatabase.getInstance().getReference().child("Users");
FirebaseRecyclerOptions options = new FirebaseRecyclerOptions.Builder().setQuery(query.orderByChild("name"), User.class).build();
FirebaseRecyclerAdapter adapter = new FirebaseRecyclerAdapter(options)
{
@Override
protected void onBindViewHolder(final UserHolder holder, int position, User model) {
final String userid = getRef(position).getKey();
holder.setHolder(userid);
}
@Override
public UserHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.user, parent, false);
return new UserHolder(UsersActivity.this, view, getApplicationContext());
}
};
recyclerView.setAdapter(adapter);
我想随机列出我的用户 .
我怎样才能做到这一点?
谢谢 .