2

I'm trying to convert TextView into a string and I'm not sure if I'm going about it the right way, below is the code I thought would work but I keep getting errors.

TextView test1 = (TextView)findViewById(R.id.result1);
String testA = test1.getText().toString();

Is this the correct method to do this or is there another way? Any help would be appreciated.

4

1 に答える 1

5

Your code is correct. Beware that it will only work once onCreate has been called and your contentView has been set.

于 2013-01-02T18:25:24.917 に答える