Below is my firebase structure:
Code I am using to set the limit to data :
@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);
}
}
This code gives me all the child in that specific node.
Please suggest what should be added to set limit to it.
Update:
I have added limit to First then I checked documentation which says set OrderBy also to it.
So in which order should I set to get the proper results.
My URL: https://wazznow-cd155.firebaseio.com/Cricket/%20IPL/%20MI%20vs%20XXR/%20ABC123/StadiumChat.json?limitToFirst=10&orderBy=%22%22&print=pretty