4

I am trying to setup JFeinstein10's sliding menu in eclipse.

What i've tried:

  1. file > import > from existing android.. > select the library of sliding menu
  2. file > import > from ex.. > select the example of sliding me
  3. file > import > from ex.. > select actionbarsherlock library
  4. mark slidingmenu lib and actionbarlib as library
  5. add the library's to example of sldingmenu
  6. cleanup all

and then i get various errors (like: jar mismatch, .. cannot be resolved to a type, the method .. of type .. must override a superclass method) i googled them and use the cleanup and quick fix options. but i doesn't work.

I hope one of you knows a good tutorial, or maybe is able to write one or knows what to do.

I'm new to android development, all my previous apps are made in a webview.

I've also tried https://github.com/johnkil/SideNavigation (didn't work either, if someone knows how to setup this, great to!) and grimbo sliding menu (it worked, but it's not what i'm looking for)

errors are in library only in slidingmapactivity (showed below) and in actibarsherlock library there are many files with errors (almost in any file in src folder)

code in lib: slidingmapactivity:
package com.slidingmenu.lib.app;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

import com.slidingmenu.lib.SlidingMenu;

public abstract class SlidingMapActivity extends MapActivity implements         SlidingActivityBase {

private SlidingActivityHelper mHelper;

/* (non-Javadoc)
 * @see com.google.android.maps.MapActivity#onCreate(android.os.Bundle)
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHelper = new SlidingActivityHelper(this);
    mHelper.onCreate(savedInstanceState);
}

/* (non-Javadoc)
 * @see android.app.Activity#onPostCreate(android.os.Bundle)
 */
@Override
public void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mHelper.onPostCreate(savedInstanceState);
}

/* (non-Javadoc)
 * @see android.app.Activity#findViewById(int)
 */
@Override
public View findViewById(int id) {
    View v = super.findViewById(id);
    if (v != null)
        return v;
    return mHelper.findViewById(id);
}

/* (non-Javadoc)
 * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    mHelper.onSaveInstanceState(outState);
}

/* (non-Javadoc)
 * @see android.app.Activity#setContentView(int)
 */
@Override
public void setContentView(int id) {
    setContentView(getLayoutInflater().inflate(id, null));
}

/* (non-Javadoc)
 * @see android.app.Activity#setContentView(android.view.View)
 */
@Override
public void setContentView(View v) {
    setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

/* (non-Javadoc)
 * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
 */
@Override
public void setContentView(View v, LayoutParams params) {
    super.setContentView(v, params);
    mHelper.registerAboveContentView(v, params);
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
 */
@Override
public void setBehindContentView(int id) {
    setBehindContentView(getLayoutInflater().inflate(id, null));
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
 */
@Override
public void setBehindContentView(View v) {
    setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
 */
@Override
public void setBehindContentView(View v, LayoutParams params) {
    mHelper.setBehindContentView(v, params);
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
 */
@Override
public SlidingMenu getSlidingMenu() {
    return mHelper.getSlidingMenu();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#toggle()
 */
@Override
public void toggle() {
    mHelper.toggle();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
 */
@Override
public void showContent() {
    mHelper.showContent();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
 */
@Override
public void showMenu() {
    mHelper.showMenu();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
 */
@Override
public void showSecondaryMenu() {
    mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
 */
@Override
public void setSlidingActionBarEnabled(boolean b) {
    mHelper.setSlidingActionBarEnabled(b);
}

/* (non-Javadoc)
 * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
 */
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    boolean b = mHelper.onKeyUp(keyCode, event);
    if (b) return b;
    return super.onKeyUp(keyCode, event);
}

}

Idris
  • 997
  • 2
  • 10
  • 27
Mdlc
  • 7,128
  • 12
  • 55
  • 98
  • [this](http://stackoverflow.com/a/10046725/1289716) may help you... – MAC Dec 21 '12 at 14:10
  • 1
    Have look on http://stackoverflow.com/questions/14057367/exact-procedure-to-add-jfeinstein10-slidingmenu-in-android-project/14118683#14118683 . It might help you and other – Saurabh Bayani Feb 04 '13 at 11:30
  • 2
    I am using the same JFeinstein10's sliding menu library downloaded from [here](https://github.com/jfeinstein10/slidingmenu) and faced some issues while importing the library into eclipse. I found an excellent post solving all the library import issues. the link is here : http://boroniatechnologies.com/installing-slidingmenu-android-library-and-example/ – suresh cheemalamudi Mar 01 '13 at 04:30

2 Answers2

4

Well let's deal with these problems one at a time ...

  • JAR Mismatch - I presume this is the support library. Replace the JAR in the SlidingMenu libs folder with the copy from your own libs folder.

  • Cannot be resolved to a type suggests that you haven't clicked on your projects properties and added SlidingMenu to the libraries box. Failing that, press Cmd-Shift-O within your Activity file to fix your imports. This will also fix your @Override issues I believe.

Let me know how you get on and I'll provide further assistance as required.

Rawkode
  • 21,990
  • 5
  • 38
  • 45
  • Thank you, Jar mismatch is gone now, I only have the errors: Cannot cast from activity to sherlockfragment activity (new) but i still have cannot be resolved to a type and cannot be resolved – Mdlc Dec 21 '12 at 14:12
  • I'm trying to get the example given on jfsteinslidingmenu to work and the example itself has no errors (only a red question mark) only the library's have. – Mdlc Dec 21 '12 at 14:31
  • I've got Johnkil Sidenavigation to work! Thanks for you help! – Mdlc Dec 22 '12 at 11:40
0

You need to have same android-support-v4 JAR in both of you SLIDINGMENULIBRARY's libs directory as well as you PROJECT's libs folder.

As a matter of fact go to you SDK folder the go to sdk\extras\android\support\v4\android-support-v4.jar copy this jar and paste it into both directories.

  • Thanks for your answer! But as you can see I solved it already. Also, there is no need to have the same JAR twice. You can also include a single jar in one of your projects. – Mdlc Aug 01 '14 at 13:29