how to get text from textview

前端 未结 5 1096
有刺的猬
有刺的猬 2020-12-01 13:40

if I have set text in textview in such way, which is not problem:

  tv.setText(\"\" + ANS[i]);

this simply getting from this way.



        
5条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 14:34

    split with the + sign like this way

    String a = tv.getText().toString();
    String aa[];
    if(a.contains("+"))
        aa = a.split("+");
    

    now convert the array

    Integer.parseInt(aa[0]); // and so on
    

提交回复
热议问题