On Feb 1, 6:46 pm, Ted Scott <t...@hootinholler.com> wrote: > On 2/1/2012 11:01 AM, atcal wrote: > > > > > On Feb 1, 4:25 pm, Ted Scott<t...@hootinholler.com> wrote: > >> On 2/1/2012 4:11 AM, atcal wrote: > > >>> I'm trying to define my own View subclass. > >>> public class myView extends View { > >>> myView(Context context) { > >>> View(context); > >>> } > >>> } > >>> Eclipse flags the first line of my constructor with an error "Implicit > >>> super conctructor View() is undefined. Must explicitly invoke another > >>> constructor" and the second line is flagged with the error "The method > >>> View(Context context) is undefined for the type myView." > >>> What does all this mean? The android documentation shows the > >>> constructor View(Context context) as public. Why can't I use it? > >> There are several reasons why View() is not available and will never be > >> available. > > >> It means you don't understand class instantiation and the life cycle of > >> a class. This is not an Android issue at all and I suggest that you > >> spend some time learning Java fundamentals. These folks are generally > >> pretty helpful with thathttp://www.javaranch.com/-Hide quoted text - > > >> - Show quoted text - > > Ted, > > > Thanks. You are probably right. While I have 10 yrs experience of C++ > > with Windows and Java looks deceptively similar, things like this are > > tripping me up. I do understand about classes and instantiating > > objects but obviously not the peculiarities of Java. I've tried to > > register at javaranch but the website is not fast at sending back the > > registration activation email. I'll have to learn to be patient. > > I meant that they have tutorials and stuff. Since you have the syntax > etc from c++ then maybe the O'Riely book Java in a Nutshell would be > helpful. Oh, and you can forget the evil multiple inheritance and > pointer stuff. ;) > > Probably a little tedious for you, but there is > this:http://docs.oracle.com/javase/tutorial/java/javaOO/index.htmlwhich > lacks a bit of detail as to why, but does cover the how of fundamentals.- > Hide quoted text - > > - Show quoted text -
Tom, I think I have to disagree with you when you say this is not an Android issue. I've just double checked the documentation and View is an Android class so my problems with it as an Android issue, not a Java issue. Can anyone answer my initial question? How do I subclass android.View? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en