2017-02-17 65 views
1

下面是我的火力结构:limitToFirst在火力地堡查询引用未在Android上工作

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); 
    connectDetector = new ConnectDetector(getActivity()); 
    if(connectDetector.getConnection()) { 
     alanRef = new Firebase(firebaseURL).child(EventChatActivity.SuperCateName + "/ " + eventDetail.getCategory_name() + "/ " + eventDetail.getEvent_title() + "/ " + EventChatActivity.eventID).child("StadiumChat"); 
     alanRef.limitToFirst(mPageLimit).startAt(mPageEndOffset); 
     userName = MyApp.preferences.getString(MyApp.USER_NAME, null); 

    } 
} 

这段代码:我使用设置限制数据

enter image description here


代码给我所有特定节点中的孩子。

请建议应该添加什么来限制它。


更新:

我已经加入限一是然后我检查它说设置排序依据也给它的文档。

所以我应该设置哪个顺序来获得正确的结果。

我的URL:https://wazznow-cd155.firebaseio.com/Cricket/%20IPL/%20MI%20vs%20XXR/%20ABC123/StadiumChat.json?limitToFirst=10&orderBy=%22%22&print=pretty

回答

-1

要应用限制,您需要使用Query .class。

int mPageEndOffset = 0; 
int mPageLimit = 10; 
Query alanQuery; 

alanRef = new Firebase(firebaseURL).child(EventChatActivity.SuperCateName + "/ " + eventDetail.getCategory_name() + "/ " + eventDetail.getEvent_title() + "/ " + EventChatActivity.eventID).child("StadiumChat"); 
Query alanQuery = alanRef.limitToFirst(mPageLimit);