At the moment I have all the data loaded from the database, I want it to load with a certain amount and reach the end, load it further.

private FirebaseRecyclerAdapter getMAdapter(Query query){ mActivity = getActivity(); final Dialog mDialog = new Dialog(mActivity, R.style.NewDialog); mDialog.addContentView( new ProgressBar(mActivity), new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT) ); mDialog.setCancelable(true); mDialog.show(); FirebaseRecyclerOptions<Post> options = new FirebaseRecyclerOptions.Builder<Post>() .setQuery(query, Post.class) .build(); mAdapter = new FirebaseRecyclerAdapter<Post, PostViewHolder>(options) { @Override protected void onBindViewHolder(PostViewHolder viewHolder, int position, final Post model) { final DatabaseReference postRef = getRef(position); // Determine if the current user has liked this post and set UI accordingly if (model.stars.containsKey(getUid())) { viewHolder.starView.setImageResource(R.drawable.ic_toggle_star_24); } else { viewHolder.starView.setImageResource(R.drawable.ic_toggle_star_outline_24); } if (!TextUtils.isEmpty(model.kzSongytblink)) viewHolder.mImage.setImageResource(R.drawable.on_line_logo); else viewHolder.mImage.setImageResource(R.drawable.off_line_logo); // Bind Post to ViewHolder, setting OnClickListener for the star button viewHolder.bindToPost(model, new View.OnClickListener() { @Override public void onClick(View starView) { // Need to write to both places the post is stored DatabaseReference globalPostRef = mDatabase.child("songsDB").child(postRef.getKey()); // Run two transactions onStarClicked(globalPostRef); } }); viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mActivity, PostDetailActivity.class); intent.putExtra(PostDetailActivity.EXTRA_POST_KEY, postRef.getKey()); startActivity(intent); } }); } @Override public PostViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); return new PostViewHolder(inflater.inflate(R.layout.item_post, viewGroup, false)); } @Override public void onDataChanged() { super.onDataChanged(); mDialog.dismiss(); } }; return mAdapter; } public void ShowData(Query postsQuery) { mAdapter = getMAdapter(postsQuery); mRecycler.setAdapter(mAdapter); } 
  • Where in the shown code do you read and what does not work? For insert happens batchSize, for select you can make a temporary pool. What will the “end” of which you want to achieve depend on? - Dred
  • for example, to begin with let them load up to 30 items in the list. When the user reaches 30 items, he should load the next 30 items. - Zhanbolat Maratov
  • Show your achievements and that you can not. The idea is, and errors in the code? - Dred
  • one

0