我正在使用firebase构建社交应用程序,涉及个人资料活动,我只想发布我不能发布的个人帖子,我设法将所有用户发布的帖子作为新闻提要发布到主页上,但我无法仅过滤用户帖子,this is the users node with the person id as a child
我尝试过
<div id="container">
<div class="link">Hover me now !
<span class="tip">
Some few text here<br><br>
Let's try something else<br><br>
And adding more info here too<br><br>
And even a bit more here also
</span>
</div>
</div>
并返回一个空的recyclerview
答案 0 :(得分:0)
如果您要发布特定于用户的帖子,则必须使用
FirebaseRecyclerOptions<Posts> options = new FirebaseRecyclerOptions.Builder<Posts>().setQuery(PostRef.orderByChild("Uid").equalTo(FirebaseAuth.getInstance().getUid())),Posts.class).build();
此PostRef.orderByChild(“ Uid”)。equalTo(FirebaseAuth.getInstance()。getUid())查询过滤当前用户帖子
您还可以获得除当前用户特定的帖子以外的所有信息,只需在equalTo函数中将FirebaseAuth.getInstance()。getUid()更改为用户ID