-5

there's a way to extends AppCompatActivity and LinearLayout?

when I do this , it's full of error

public class MessageContainerView extends AppCompatActivity,LinearLayout implements OnLayoutChangedListener, OnCreateContextMenuListener,OnClickListener,TextToSpeech.OnInitListener 

How can I solve that?

3 Answers3

2

Java basic :

A class can only extend one other class. A class can implement several interfaces.

Please refer the following link Implements vs extends: When to use? What's the difference?

Community
  • 1
  • 1
Rajasekhar
  • 2,345
  • 1
  • 13
  • 20
0

You can extend either AppCompatActivity or LinearLayout, but not both. Java does not allow to multiple inheritance

Fernando Tan
  • 634
  • 4
  • 14
0

you cannot extends multiple class in a single class because android is java based and java cannot support multiple inheritances using the class.So you can only one class extends at a time

Bhupat Bheda
  • 1,968
  • 1
  • 8
  • 13