I'm working on an ICS (4.0.3) tablet app where we're using DialogFrament
extensively. When the user does a long press inside a text editor in a dialog fragment I need to prevent the copy/paste action bar from appearing at the top of the screen. Fortunately we have our own base class extending DialogFragment
(call it MyOrgDialogFragment
) that all our dialog fragments are based on, so I can modify that if required.
My first attempt has involved overriding OnCreateDialog()
in MyOrgDialogFragment
, then overriding onWindowStartingActionMode()
inside that, i.e.:
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
return new Dialog(getActivity()) {
@Override
public ActionMode onWindowStartingActionMode(ActionMode.Callback callback)
{
return new ActionMode()
{
// [ All overrides empty ]
}
}
};
}
This nearly works: it prevents the action bar from appearing, and the selection handles still appear when I long-press in an edit field (which is fine), but the selection handles aren't dismissed correctly when I move focus onto another edit field. I end up with "zombie" selection handles hovering over each edit field I've made a selection in.
Can anyone point me towards a better solution?