com.google.firebase.database.Query.limitToFirst()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中com.google.firebase.database.Query.limitToFirst方法的一些代码示例,展示了Query.limitToFirst的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.limitToFirst方法的具体详情如下:
包路径:com.google.firebase.database.Query
类名称:Query
方法名:limitToFirst

Query.limitToFirst介绍

[英]Create a query with limit and anchor it to the start of the window.
[中]使用limit创建一个查询,并将其锚定到窗口的开头。

代码示例

代码示例来源:origin: chat-sdk/chat-sdk-android

.orderByChild(Keys.Meta + '/' + index)
    .startAt(value)
    .limitToFirst(limit);
query.keepSynced(true);

代码示例来源:origin: TomGrill/gdx-firebase

@Override
public Query limitToFirst(int limit) {
  return new DesktopQuery(query.limitToFirst(limit));
}

代码示例来源:origin: UdacityAndroidDevScholarship/quiz-app

@Override
public void fetchResources(int startFrom, int limit, Callback<List<Resource>> callback) {
  ValueEventListener listener = new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot snapshot) {
      if (snapshot != null) {
        List<Resource> resources = new ArrayList<>();
        for (DataSnapshot childSnapshot : snapshot.getChildren()) {
          Resource resource = childSnapshot.getValue(Resource.class);
          resources.add(resource);
        }
        callback.onReponse(resources);
      }
    }
    @Override
    public void onCancelled(DatabaseError databaseError) {
      callback.onError();
    }
  };
  Query resourcesQuery = mResourcesRef.orderByChild(KEY_TIMESTAMP);
  if (limit > 0) {
    resourcesQuery.limitToFirst(limit);
  }
  resourcesQuery.addValueEventListener(listener);
  mValueListeners.add(listener);
}

代码示例来源:origin: UdacityAndroidDevScholarship/quiz-app

quizzesRefQuery.limitToFirst(limitToFirst);

代码示例来源:origin: dragosholban/AndroidMyInstagramApp

Query imagesQuery = database.child("images").orderByKey().limitToFirst(100);
imagesQuery.addChildEventListener(new ChildEventListener() {
  @Override

相关文章