Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why "Implement" Another Class in same package?

 
AhFai Chan
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and pardon my basic questions.

I have a package with several classes and I had to "implement" an interface from another class. Here are the code snippets:



And here is the main activity that implements the above defined WorkoutLiswtListener


QUESTION: I thought if both classes are in the same package, I could create a reference in one to the other and implement whatever is in the other one, what have I missed?
 
Campbell Ritchie
Sheriff
Posts: 51447
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand the question. Are you suffering some sort of error message?
 
Les Morgan
Rancher
Posts: 711
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are probably getting a complaint about your MainActivity not containing a method: void itemClicked(long). When you implement an Interface you have to code all the elements described by the Interface--which includes all of the signatures of the methods defined by the Interface.
 
AhFai Chan
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Les Morgan wrote:You are probably getting a complaint about your MainActivity not containing a method: void itemClicked(long). When you implement an Interface you have to code all the elements described by the Interface--which includes all of the signatures of the methods defined by the Interface.


Thanks.

Another simple basic question:

One of my problems with Java is finding a go-to link for a structured list of all sub-classes and related methods. For example, I'd like to find a link where I can read up on all the classes and methods of a super root very big class View

In this case, Android's View are any GUI, like buttons, checkboxes, spinners etc. and I have to pull the Android:onClick="myOwnOnClickStart" out of the XML and implement it in Java code instead





 
Knute Snortum
Bartender
Pie
Posts: 2908
62
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Docs show you the super class and any known implementing classes, but maybe you need something more specific to Android. I'll move the thread to Mobile -> Android.
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AhFai Chan wrote:a go-to link for a structured list of all sub-classes and related methods.


You means Android documentation? Or do you mean an easy way to see the structure of your own code? For your own code, click the bottom left corner and choose Structure from the popup menu.

 
AhFai Chan
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian Tkatch wrote:
AhFai Chan wrote:a go-to link for a structured list of all sub-classes and related methods.


You means Android documentation? Or do you mean an easy way to see the structure of your own code? For your own code, click the bottom left corner and choose Structure from the popup menu.



Yes, I mean Android documentation. I'd like to see all the widgets and methods() available bothering someone on a forum.
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AhFai Chan wrote:Yes, I mean Android documentation. I'd like to see all the widgets and methods() available bothering someone on a forum.


The documentation is at https://developer.android.com/reference/. A google search for a particular package will usually link you to the documentation there as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic