How to handle the "paste" event in Android 3.0(Honeycomb)?

Viewed 3542

I have a customized EditText, which need to do customized "paste".

I overrode onTextContextMenuItem(int id) to handle "paste" requested by selecting context menu.

@Override
public boolean onTextContextMenuItem(int id) {
  switch(id){
  case android.R.id.paste:
    doMyPaste();
    return true;
  }
}

This works in Android before 3.0.
In 3.0, however, there is a small "paste" widget near the cursor widget if it's long-pressed, or the cursor is tapped.
enter image description here
When user do "paste" from this widget, the onTextContextMenuItem(int id) won't be invoked. As a result, I can't do the customized paste.
Do any one knows what that small "paste" widget is? Which method should I overrode to do a my own "paste"?

2 Answers

call past event inside afterTextChanged() method check now

editBox.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                // do with text
            }

            @Override
            public void afterTextChanged(Editable s) {
                // do with text
               Toast.makeText(getApplicationContext(), "call past", Toast.LENGTH_SHORT).show();
            }
        });
Related