Tobias Moe Thorstensen
Tobias Moe Thorstensen

Reputation: 8981

Attach OnClickListeners to the Slidemenu

I've implemented ActionBarSherlock and the Slidemenu by jfeinstein10 in my android application. Everything seems to work quite well; the menu is showing when I fling my finger over the screen and also when I press the application icon in the ABS. What I did was to include the ABS project as a library to the Slidemenu as described. Once this was done, I added the slidemenu as a library to my existing android project. So I have my class declaration:

public class Home extends SlidingActivity

Where the SlidingActivity extends SherlockActivity. All this is described at the GitHub link above.

What I've been struggling with, is how I can implement the menu. The ListView inside the SlideMenu should contain some sort of menu items which has a OnClickListener attached. So when the user opens this slidemenu, it will present a menu like:

  1. Home
  2. Settings
  3. About

Once the user presses on of this items, a new Activity should be launched.

Can somebody give me a hint or the source code to where I should implement such logic?

Upvotes: 0

Views: 175

Answers (1)

Ahmad
Ahmad

Reputation: 72663

You have to replace the behindContent with a ListFragment. This is how you'll have an onClickListner. The Fragment will handle it.

Upvotes: 1

Related Questions