34

I'm trying to use the SlideMenu library with ActionBarSherlock. https://github.com/jfeinstein10/SlidingMenu

http://actionbarsherlock.com/

I had not issue installing actionbarsherlock and run the examples provided. But, can't do the same with the example og the SlideMenu library :(

I can set up the library fine (or so i think) without errors (under eclipse with jre6).

For the slidemenu example, i created the project, and added com_actionbarssherlock.jar as a "referenced libraies".

But i have lots of : - R cannot resolve erros ; - can't overrides some methods erros; - methods from actionbarsherlock are not recognized ; ex : "The method getSupportActionBar() is undefined for the type BaseActivity" - can't load style from actionbarsherlock erros.

It is as if the project doesn't see the classes from actionbarsherlock.

Thanks for any help.

enter image description here

user1391967
  • 497
  • 1
  • 6
  • 13
  • try cleaning your project and run again – Lucifer Nov 18 '12 at 08:40
  • 1
    Check this page , 100% working ;) [Installing SlidingMenu Android library and example](http://boroniatechnologies.com/installing-slidingmenu-android-library-and-example/) – Soheil Setayeshi Apr 21 '13 at 13:45
  • You gotta stop it.When have problems,there is not enough documentation.Oh actually no documentation.so skip this sliding menu. – erginduran Jun 29 '15 at 13:14

3 Answers3

135

For the error

"The method getSupportActionBar() is undefined for the type BaseActivity"

Inside the SlidingMenu library, edit the class SlidingFragmentActivity to extend SherlockFragmentActivity (like below). Then clean and rebuild, this method should now be found.

public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {

Source

marcbest
  • 1,600
  • 1
  • 10
  • 15
  • Thank you very much !!! after long frustrating search finally i can run example !! now next i have to look for "how to implement it in my own project" please help me if you can ! Thanks again. +1 for you – Saurabh Bayani Dec 30 '12 at 18:32
  • 8
    I wonder how they can run that sample app without error to push that to Github master branch ?? – toantran Apr 08 '13 at 18:46
  • don't forget clean the project. – javan May 23 '13 at 07:19
  • Its work... great after spending 2hrs. We need to add Sherlock library for both sliding menu library as well as actual application. Tanks buddyy... – Gru Jun 27 '13 at 13:14
  • 1
    Many thanks for this. I did the above and then added ActionBarSherlock as a library to the SlidingMenu library project. Surely there must be a reason why this builds okay on the developers' system - I'd be very keen to understand why. – Trevor Jul 16 '13 at 22:57
  • I did this and Im getting a nullpointerexception at getSlidingMenu() (which is implemented in my class and it returns null) so what do I do? – Kaloyan Roussev Oct 13 '13 at 13:39
  • 2
    The examples from SlidingMenu needs ABS. Why is this not done per default in git? – powder366 Jan 14 '14 at 14:58
0

Look add Problems tab to see there are any error ? Right click your project and check your all Libraries. If everthing ok, try to clean your project.

Talha
  • 12,673
  • 5
  • 49
  • 68
  • Ok, i did check my libraries. I did import the jar files of the both libraries. I switch to put them in the "add library" in the android tab of the build path menu. I still have two errors : - getSupportActionBar() method is undefined. This method is supposed to be in actionbarsherlock. I don't understand why eclipse doesn't see it. - onOptionsItemSelected() can't be override. Same thing, eclipse doesn't see that it is part of actionbarsherlock. My example activity extends slidemneuactivty wich extends sherlockactivity, so it should work. I did try to clean my project. Any ideas ? – user1391967 Nov 18 '12 at 17:02
0

There are lots of issues on github with that bug. Mrcb123's solution works, but I suppose it will be good to separate example ABS dependency from library.

MainActivity
  • 1,650
  • 2
  • 12
  • 16