Extract a line from an EditText

后端 未结 3 1195
谎友^
谎友^ 2021-01-12 19:29

How can we extract a line from a multiLine EditText ?

I tried this way, but I know that is not a good practice :

String street1 = \"\";
         


        
3条回答
  •  梦谈多话
    2021-01-12 19:57

    Try this,

    String text=editText1.getText().toString().replace("\n", " ").trim();
    

提交回复
热议问题