In my Android app I need to provide some custom actions on the contextual action menu after the user selects some text. To do so, I capture long clicks and start the action mode, providing a custom ActionMode.Callback
(as pointed out in Android Docs). The problem is that this way the selection text cursors won't show up. So, is there any way to activate the selection text mode programmatically??
Asked
Active
Viewed 1,289 times
1

davids
- 6,259
- 3
- 29
- 50
2 Answers
0
public void SelectText(){
try{
KeyEvent shiftPressEvent =
new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
shiftPressEvent.dispatch(mWebView);
}catch(Exception e){
throw new AssertionError(e);
}
}
In this case we are activating text select on mWebView

Richard
- 14,427
- 9
- 57
- 85
-
Nothing happening. Already checked that this code is being executed, but the cursors don't show up (testing in ICS) – davids Sep 26 '12 at 12:05
0