2016-08-04 64 views
0

enter image description hereAndroid的火力地堡查詢返回什麼

以上是我的火力點數據庫:

-Ideas 
    --Key generated by firebase 
    --uid 
    --name 
    --date 
    --title 

現在我想通過一個特定的UID產生的所有想法和查詢附加到回收站。以下是我的查詢和適配器​​,但它什麼都沒有返回。

DatabaseReference myIdeasReference = FirebaseDatabase.getInstance().getReference(); 
    final Query myideas =myIdeasReference.child("Ideas")orderByKey().equalTo("userUid",userUid); 
    mAdapter = new FirebaseRecyclerAdapter<Idea, IdeaHolder>(Idea.class, R.layout.listview_feed, IdeaHolder.class, myideas) { 
     @Override 
     public void populateViewHolder(IdeaHolder IdeaViewHolder, final Idea ideaObject, int position) { 
      int voteCountint = ideaObject.getvoteCount(); 
      String voteCount = Integer.toString(voteCountint); 
      int flagCountint = ideaObject.getflagCount(); 
      String flagCount = Integer.toString(flagCountint); 
      String title = ideaObject.gettitle(); 
      String body = ideaObject.getBody(); 
      String postDate = ideaObject.getPostDate(); 
      String mfullName = ideaObject.getfullName(); 
      //pass values :key, Ideauid and Userid to setbutton method in ideaviewholder class 
      DatabaseReference idearef = getRef(position);//get the database reference of the object at selected position 
      final String key = idearef.getKey();//get key of the idea reference to get the location later in mvote and mflag 
      String ideaUid = ideaObject.getuid(); 

P.S.我也嘗試了以下查詢:

 final Query myideas = myIdeasReference.child("Ideas").orderByValue().equalTo("userUid",userUid); 

但隨後也沒有顯示。

回答

0

嘗試用這個,這應該爲你工作

myideas = myIdeasReference.child("Ideas").orderByChild("userUid").equalTo(userUid);