Reputation: 49
I know that java doesn't support multiple inheritance. So how can i fulfill following requirement.
This is my current class:
public class Class1 extends ExpandableListActivity implements ExpandableListView.OnChildClickListener, OnTouchListener, OnItemLongClickListener, OnClickListener, Runnable
{
@Override
public void onCreate(Bundle savedInstanceState) {
...
}
}
Now i also want to extends it using "FragmentActivity" class.
Example:
public class Class1 extends ExpandableListActivity, FragmentActivity implements ExpandableListView.OnChildClickListener, OnTouchListener, OnItemLongClickListener, OnClickListener, Runnable
{
@Override
public void onCreate(Bundle savedInstanceState) {
...
}
}
Upvotes: 2
Views: 2579
Reputation: 701
In java a class cannot extent more than one class. But Interface can extends more than one classes.
This is only way to extends more than one class and then use that interface in your class.
Upvotes: 0
Reputation: 4874
You cannot. You are implementing an activity, so it should be either an ExpandableListActivity or a FragmentActivity, but it cannot be both. Depending on what your actual needs are, you should choose one. But one approach that is possible is to add an ExpandableListView to your FragmentActivity layout.
Upvotes: 1
Reputation: 1585
we can show ExpandableListView in android XML file.So, use Fragment Activity show ExpandableListView in android XML.
Upvotes: 0