When i want to Generate Signed app it tells me :
Error:Error: This class should provide a default constructor (a public constructor with no arguments) (com.example.discopc.beautiyuser.Customy) [Instantiatable]
My Project :
public class Customy extends ArrayAdapter<String> {
private final Activity context;
View v;
private final String[]name;
public Customy(Activity context, String[] name){
//super(null,0);
super(context,R.layout.activity_customy,name);
this.context=context;
this.name=name;
}
public View getView(final int position,View convertView,ViewGroup parent){
try{
LayoutInflater infalter=context.getLayoutInflater();
v=infalter.inflate(R.layout.activity_customy,null,true);
TextView txtName=(TextView)v.findViewById(R.id.name);
txtName.setText(""+name[position]+"");
}catch(Exception e){
}
return v;
}
}
Note: It works fine when debugging on my android device but i cant
Build > Generate Signed app
I Really don't know what to do.
Thanks ,
Check by mistake you have added that adapter name in Android Manifest. If yes, remove that and try.
A default constructor is a constructor for a class which has no arguments and can be used implicitly.
public Customy( /* notice - no arguments */) {
// your code here
}
But in your case - this must not be the issue. The issue is that you have this class somewhere in your XML configuration where some framework is trying to instantiate it using a default constructor, while we obviously see that you need to pass 2 parameters to your constructor for the class instance to function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With