Android - Programmatically select a menu option

684 views Asked by At

I know there's already been a question like this but unfortunately there is no actual answer there.

I'm writing a file manager-like application that uses only keyboard input (which, as you could guess, is total fun to code in Android). When a user navigates to a file and does a long-click on it, I programmatically create an ActionMode and I'd love to have a way to select (to select, not to simulate a click) its first item because navigating from the last file, all the way to the top can be a real chore.

So, is there a way to do that?

I have used :

getActivity().startActionMode(ActionMode.Callback callback)

with callback being defined beforehand.

1

There are 1 answers

0
Dogcat On BEST ANSWER

Thought I've already posted that.

Seems like there's no way to select an ActionMode item, so I swapped an ActionMode for a floating ContextMenu, and it worked.