In the xml template I have EditText:

<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textMultiLine" android:ems="10" android:id="@+id/edit_cmnt_field" android:layout_weight="1" /> 

In the code I connect it:

 textField = (TextView) findViewById(com.frienddime.frienddime.R.id.edit_cmnt_field); 

And then I want to set the cursor to a certain position, for this I write a textField. and start typing setSelection, but it is unavailable, it is printed in red. I looked at different examples, there is a setSelection and it works without problems. Why is it not available to me?

Closed due to the fact that the participants are off topic : , pavlofff , cheops , aleksandr barakin , user194374 14 Jun '16 at 10:48 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Yuriy SPb, pavlofff, cheops, aleksandr barakin, Community Spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    You confused the type of your variable. In the markup you have EditText, and in the code TextView, which has no such method.

    Change variable class to EditText

    • one
      Exactly, somehow I skipped) Everything, now it works! - cheerful_weasel