Skip to content Skip to sidebar Skip to footer

How To Use A Constructor That Already Exists?

I am building a simple app for children with Firebase and I'm constantly getting this error: Android Firebase Database exception: not define a no-argument constructor I have a cla

Solution 1:

There are two methods in which you can get rid of this error.

  1. Make both inner classes static.

  2. Make both inner classes independent (each class in it's own separte file).

That's it!

Solution 2:

Constructor of HomeActivities() has default visibility. public keyword is missed. Database ORM provider can't instantiate objects when the constructor is not public.

Should be:

classHomeActivities {
    private String name;
    privateint noOfChildren;

    publicHomeActivities() { }

All other suggestions are valid as well. You should externalize classes in separate files.

Post a Comment for "How To Use A Constructor That Already Exists?"