Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in startActionMode, appcompat

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?

like image 647
user3176367 Avatar asked Jan 23 '14 09:01

user3176367


1 Answers

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()); 
like image 173
nstCactus Avatar answered Sep 28 '22 03:09

nstCactus