View Full Version : My java is not so hot, but...
caywen
11-15-2007, 03:49 PM
it's been 5 years since I touched Java, so I apologize if this is a Java skill problem and not a legit question:
Is it me or is android.view.View declared with a private constructor? If that's the case and I'm not mistaken, is it not then possible to subclass it? When I attempt to subclass in my package, I get:
"Implicit super constructor View() is not visible for default constructor. Must define an explicit constructor"
Again, I'm still just getting up to speed with the language, but would appreciate any help with this.
caywen
11-15-2007, 03:55 PM
I'm kind of baffled. I declared a class in my package and got that error. However, after deleting it, and readding with the "Constructors from superclass" checkbox, it doesn't complain anymore. However, the new code and what I originally had were identical!
Strange...
Hi,
I have "some skills" on Java, but not really do nothing more than hellow android yet.
Your problem may because in java, every Object is herited from the root one, in Java standard it's Object class. It may/must be the same with this VM. So you may call the default constructor first : super(); or something like that, it depends on default parent's constructor.
Take a look on documentation, gl !
BQT
i re-red your question, took a look of doc, and understand better your problem.
THERE ARE NO PUBLIC DEFAULT CONSTRUCTOR with this signature : View();
you have to call, one of theses [from doc] :
Public Constructors
View(Context context)
Simple constructor to use when creating a view from code.
View(Context context, AttributeSet attrs, Map inflateParams)
Constructor that is called when inflating a view from XML.
View(Context context, AttributeSet attrs, Map inflateParams, int defStyle)
Perform inflation from XML and apply a class-specific base style.
MaliceMcGuire
12-20-2008, 01:43 AM
I know its late but.. I gotta giggle..
I declared a class in my package and got that error
thats a line I shall never forget lol :D
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by
vBSEO 3.2.0