简体   繁体   中英

How can I prevent letter download after a certain number character Firebase

I don't want to download all the characters in the data. Example: First, the first 500 characters should be downloaded automatically, if the user presses "more", all other characters will be downloaded as well.

databaseReference =
FirebaseDatabase.getInstance().getReference().child("Post").child(PostKey);

 databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
          
            content = dataSnapshot.child("content").getValue().toString();
            txtcontent.setText(content);

   
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });

Xlm:

  <TextView

                android:id="@+id/txtcontent"             
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

I want like this : 在此处输入图像描述

What you're trying to do isn't possible with what you have now. All database queries will retrieve the entire contents of any node that you request, including all nested child nodes. There are no partial downloads.

The only way to make this work the way you describe is to put only the first 500 characters into the node that you query, and put the rest of the text somewhere else that you can fetch later in a second query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM