How to insert characters in the middle of an EditText field?
I am making a calculator that can take a string expression like "3 * (10 ^ 2-8)". I use the EditText field to make a string using XML as follows:
Edittext
android:id="@+id/entry" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/label" android:text="@string/testString1" android:background="@android:drawable/editbox_background"
and then in my work I will say:
entry = (EditText)findViewById(R.id.entry); entry.setText("blablahblah"); entry.setSelection(3);
Now I have an EditText field when the cursor blinks after the third character in the line. How to insert a character there, so he correctly says "blahblahblah"?
source share