Error in startActionMode, appcompat
R

1

5

I used SherlockActionBar in my application, but after I began to use appcompat. And get error

"The method startActionMode(ActionMode.Callback) in the type Activity is not applicable for the arguments (PageFragment.ActionModeCallback)"

in the raw

   mActionMode = getActivity().startActionMode(new ActionModeCallback());

Help me please, what I do incorrect?

Ratiocinate answered 23/1, 2014 at 9:42 Comment(3)
Thanks for posting the code. It's a bit long, though--can you please edit your question to include just the relevant parts? @Gopal asked for the imports section, so I imagine you need to include that, and perhaps the specific function which is raising the error. Only include the rest of the code if it's needed.Carmody
mActionMode = ((ActionBarActivity) getActivity()).startSupportActionMode(new ActionModeCallback()); solutionRatiocinate
@user3176367: you can post and accept your own answer.so that it can be helpful to others as well.people generally don't look at the comments.Acerose
S
17

Just to improve readability, according to user3176367, the solution was to cast the result of getActivity to ActionBarActivity.

Here is the working code:

((ActionBarActivity) getActivity()).startSupportActionMode(new ActionModeCallback()); 
Sinusitis answered 5/6, 2014 at 1:30 Comment(1)
Thank @Ratiocinate instead. All I did was post his comment as an answer.Sinusitis

© 2022 - 2024 — McMap. All rights reserved.