Reputation: 158
I have an EditText and I want programatically enter in "text selection mode" indicated by CursorControllers (handles), for example when user long press on EditText.
Any examples or suggestions will highly appreciated.
Upvotes: 2
Views: 1065
Reputation: 146
Try
editText.onTextContextMenuItem(android.R.id.startSelectingText);
for pre-Honeycomb versions and
editText.onTouchEvent(MotionEvent.obtain(/* FakeLongClick */));
for Honeycomb and newer.
I'm not familiar with motion events, but i think this should work if you are able to simulate a long click event...
Upvotes: 2
Reputation: 1056
you can paste some text to EditText by...
<EditText
android:id="@+id/et_link"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Link" />
"Link" will apeear in EditText window
Upvotes: -1