• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why "Implement" Another Class in same package?

 
Ranch Hand
Posts: 271
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure I understand the question. Are you suffering some sort of error message?
 
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 271
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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





 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 271
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic