Reputation: 11331
This is a relatively general question that I have regarding to Android development.
In the Android application, I am using SlidingMenu library. Imagine the activity I am trying to implement has a Navigation Drawer (from Sliding Menu Library) and action bar tabs with View Pager and contains different fragments.
In order to have the navigation drawer in the activity, I had to inherit the application from SlidingActivity
like this:
public class ActivityMain extends SlidingActivity implements TabListener {
However, to make View Pager work in this activity, I will need to use Make a FragmentPagerAdapter instance, and if I want to use it, it requires the activity extend the Fragment Activity
.
My Activity already extended SlidingActivity
, so there is no way to extend another super class. I am not sure what will be a proper way to solve this conflict. When I was working on the Android app, I have saw some other cases that different components in one activity requires to extend from different super class. What will be the general solution to such problem?
Thank you
Upvotes: 0
Views: 771
Reputation: 507
You can wrap your Activities in a SlidingMenu by constructing it programmatically new SlidingMenu(Context context)
and then calling SlidingMenu.attachToActivity(Activity activity, SlidingMenu.SLIDING_WINDOW | SlidingMenu.SLIDING_CONTENT)
. SLIDING_WINDOW
will include the Title/ActionBar in the content section of the SlidingMenu, while SLIDING_CONTENT
does not. You can check it out in the example app AttachExample Activity.
from https://github.com/jfeinstein10/SlidingMenu
Upvotes: 0
Reputation: 6108
If you look at the package of SlidingMenu here, they have an activity called SlidingFragmentActivity
. Extend this activity instead of SlidingActivity
gives you everything you need.
Upvotes: 4