-1

i have two text views in my linear layout and dynamically text get displayed. Now how to convert that text view to a string in my application.

RaghavaRaj
  • 23
  • 1
  • 2
  • 4

2 Answers2

5

suppose your textview name is tv1 then try

String input = tv1.getText().toString();
Nambi
  • 11,944
  • 3
  • 37
  • 49
1

You cant change textview to string but you can get string from textview. This is for textview:

TextView textView;
textView = (TextView) findViewById(R.id.tv_1);
textView.setText("AFJHDFGKS");

then to get text as string:

String text = textView.getText().toString();
keshav
  • 3,235
  • 1
  • 16
  • 22