Attempt to invoke virtual method java.lang.String com.activeandroid.TableInfo.getIdName()

238 Views Asked by At

I am trying to copy values of one class1 object to class2 object using active android. I have written a clone function for this. When I instantiate class2 object, I get above mentioned exception. Here is my model

@Table(name = "table_config")
public class ConfigurationForServerSEND extends Model implements Serializable, Cloneable
{
    // bunch of variables and getters/setters
}

Whenever I call this clone method, exception gets thrown. Here is the first line of code

ConfigurationForServerSEND config = new ConfigurationForServerSEND();

Here is what I get

class package_name.views.fragments.MyFragment
java.lang.NullPointerException: Attempt to invoke virtual 
method 'java.lang.String com.activeandroid.TableInfo.getIdName()' 
on a null object reference 
at com.activeandroid.Model.<init>(Model.java:55)

Please note that I add this class configuration builder of active android, like this configurationBuilder.addModelClasses(MatchConfigurationForServerSEND.class);

What could be wrong? Why am I getting this exception when trying to instantiate class2 object. It was working yesterday (I use both Android 7, Android 8 with API level 26). Thanks for anything you share.

0

There are 0 best solutions below