0

I am creating an application which requires a webview.

I want to enable text selection in webview. (I found a few solutions but none of them worked)

Once the webview is selected, it should not be directly copied. I should be able to expand the selection range with handles (It is possible in version 2.3 and later. But I want this on versions lower than 2.3. HTC's browser gives us this option)

Any idea?

Sudarshan Bhat
  • 3,772
  • 2
  • 26
  • 53

1 Answers1

2

recently i solved that

put this function on create or on load in activity

private void emulateShiftHeld(WebView view)
{
    try
    {
        KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
                                                KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
        shiftPressEvent.dispatch(view);

    }
    catch (Exception e)
    {
        Log.e("dd", "Exception in emulateShiftHeld()", e);
    }
}

it will done...

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
Jigar Patel
  • 436
  • 4
  • 9
  • ok i got it to work... now there is a second part to the question i asked. how can i select the range of text to be selected on android 2.2? – Sudarshan Bhat Oct 13 '11 at 12:07