11

Can I implement OnClickListener and SurfaceHolder like this :

    public class MainActivity extends Activity implements SurfaceHolder.Callback,OnClickListener
francoisr
  • 4,407
  • 1
  • 28
  • 48
Ahmad Jouni
  • 185
  • 1
  • 1
  • 4
  • 1
    Of course, you can implements many interfaces in Class separated by comma (,) between each Interface name. – Manish Dubey Jul 06 '13 at 21:18
  • @AhmadJouni : Android's base is JAVA , so my advice to you is start learning basics of OOP and JAVA : http://docs.oracle.com/javase/tutorial/java/concepts/ , and then you can learn about Android ;) – Houcine Jul 06 '13 at 21:20
  • @ Houcine do you have android apps ? – Ahmad Jouni Jul 06 '13 at 21:33
  • Type that in your IDE and you will see – Alexander Kulyakhtin Jul 06 '13 at 21:34
  • First Learn Java.Then start android – Chiradeep Jul 06 '13 at 21:54
  • @AhmadJouni : yes i do – Houcine Jul 06 '13 at 22:35
  • 11
    To all down voters of this question: IMO this is a valid question that it does actually fits in SO rules. The only problem is that OP may be a little lazy or he has missed out something in the Java documentation. If you see the "on hold" reason says that there are too many possible answers or good answers would be too long, neither is correct. There is only one answer which is not too long. I think that you are punishing him and NOT the question... – ChD Computers Jul 07 '13 at 01:16
  • 5
    "One thing a Master should always remember, is that he was once an apprentice". Please avoid offensive comments like "yes you can do that" and try to teach him that next time he should find this basics by searching... – jomafer Apr 23 '14 at 15:38
  • an interesting observation: I too had this question. I decided to research it by using google. This question was the FIRST link that came up. StackOverflow is the resource I tell my studenta to use FIRST. Perhaps I should rethink that. If the answers here are any indication, there are far too many elitist prima-donas running around and not enough solid mentors. – Thorin Schmidt Apr 29 '19 at 19:01

1 Answers1

23

Yes, in Java a class can implement many different interfaces.

This compensates the lack of multiple inheritance in Java, as opposed to e.g. C++ where multiple inheritance is allowed.

francoisr
  • 4,407
  • 1
  • 28
  • 48