Reputation: 651
I'm new to android programming how to extend two activity . In my case I'm using ActionBarActivity im already extends the a class for some functionalities how shall i extend two activities my class
any example code will be more useful for me
Upvotes: 2
Views: 8649
Reputation: 26978
This is not much of a Android problem (as Activity is class as any other), it's the way Java works.
Java doesn't support multiple inheritance, so classes can only extend
one other class.
class A extends B{
}
Even in this case:
class A {
}
class A extends another class - Object
- but it is automatically implied without having to specify it.
If you want to ensure some functionality from several sources you will have to use interfaces and the implements
keyword:
class A extends B implements C,D,E {
}
Upvotes: 1