-1

Maybe this is too easy, but I can't find the solution..

For example I can copy from TextView1 with this basic code.

TextView2.setText(TextView1.getText);

I am trying to this;

How can I copy first 50% of the TextView1's text.

Thank you for helping.

Kenshin
  • 159
  • 1
  • 1
  • 9

2 Answers2

0

Try this:

TextView2.setText(TextView1.getText().subSequence(0, TextView1.getText().length()/2));
Maksym V.
  • 2,877
  • 17
  • 27
0

Try this Use substring()

TextView2.setText(TextView1.getText().toString().substring(0,TextView1.getText().toString().length()/2));
AskNilesh
  • 67,701
  • 16
  • 123
  • 163