Skip to content

Instantly share code, notes, and snippets.

@GabrielCastro
Last active January 4, 2016 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GabrielCastro/8610419 to your computer and use it in GitHub Desktop.
Save GabrielCastro/8610419 to your computer and use it in GitHub Desktop.
...
<issue
id="Instantiatable"
severity="Fatal"
message="This class should provide a default constructor (a public constructor with no arguments) (my.package.name.MyView)"
category="Correctness"
priority="6"
summary="Ensures that classes registered in the manifest file are instantiatable"
explanation="Activities, services, broadcast receivers etc. registered in the manifest file must be &quot;instantiatable&quot; by the system, which means that the class must be public, it must have an empty public constructor, and if it&apos;s an inner class, it must be a static inner class."
errorLine1=" public MyView(Context context, AttributeSet attrs, int defStyle) {
"
errorLine2=" ~~~~~~~~~~">
<location
file="C:\[...]\NumberView.java"
line="40"
column="12"/>
</issue>
...
...
public class MyView extends View {
...
public MyView(Context context) {
super(context);
init(context);
}
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public MyView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
// makes lint happy, but I shouldn't need this
public MyView() {
super(null);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment