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?
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.
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
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.
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.