简体   繁体   English

如何防止在某个数字字符 Firebase 后下载字母

[英]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.示例:首先,应该自动下载前 500 个字符,如果用户按“更多”,则所有其他字符也将被下载。

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: XL:

  <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.使这项工作按照您描述的方式进行的唯一方法是仅将前 500 个字符放入您查询的节点中,并将其余文本放在其他地方,以便稍后在第二个查询中获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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