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" />
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.