I was having some problem when trying extend more than one class in Android development. So basically what I am trying to do is I got a navigation drawer:
customAdapter = new CustomExpandAdapter(this, listParent, listDataChild);
mDrawerList.setAdapter(customAdapter);
mDrawerList.setChoiceMode(ExpandableListView.CHOICE_MODE_SINGLE);
// Navigation drawer with sub menu goes here
private void selectItem(int groupPosition, int position) {
selectedPosition = position;
mDrawerLayout.closeDrawer(navDrawerView);
// Navigation item for profile
if (groupPosition == 0) {
switch (selectedPosition) {
case 0:
break;
case 1:
break;
else if (groupPosition == 3) {
switch (selectedPosition) {
case 0:
break;
case 1:
Toast.makeText(ENeighbourhoodActivity.this, "Analyze Event",
Toast.LENGTH_LONG).show();
break;
}
}
setTitle(mEventSelection[selectedPosition]);
}
And these codes are in my MainActivity.java . Then from my MainActivity, when I selected certain button, I will navigate to Detail.java . However, in my Detail.java , I am extending FragmentActivity because I am using tab inside Detail.java :
public class EventDetailMain extends FragmentActivity {
Context context = this;
ViewPager Tab;
EventDtlTabPagerAdapter TabAdapter;
ActionBar actionBar;
}
And when I go to Detail.java, the navigation drawer is no longer there because I did not extend from the class. I wonder how should I extend from two class at the same time.
Thanks in advance.
在主要活动中,将Detail.java作为片段并编写您的代码。这样,导航抽屉也可用于您的Detail.java。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.