简体   繁体   中英

Android paste large text file into edittext

I have an app and I need users to be able to paste any amount of text into an edittext box. I would like users to be able to paste up to at least 100,000 words if possible. How can I accomplish this with android? Attaching a file isn't possible.

Here is the xml for my edittext if that helps.

    <EditText
    android:id="@+id/editText"
    android:ems="10"
    android:inputType="textMultiLine"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:text=""
    android:minLines="2"
    android:textIsSelectable="true"
    android:isScrollContainer="true"
    android:focusable="true"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView2"

    />

And if it helps this is all I am doing with the edit text

final EditText input = (EditText) findViewById(R.id.editText);
    button2.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            document = input.getText().toString();

There is no defined limit for EditText.

You can only limit it manually (android:maxLength="10")

原来我用于测试的设备无法处理输入。

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