title: ActiveAndroid Model class not initialized correctly
body: <p>I am trying to use ActiveAndroid for handling the DB in my app.</p>
  
  <p>Here is my model class:</p>
  
  <pre><code>package ro.adrian.trivia.datamodel;
  
  import java.io.Serializable;
  
  import ro.adrian.trivia.database.TriviaSQLiteHelper;
  
  import com.activeandroid.Model;
  import com.activeandroid.annotation.Column;
  import com.activeandroid.annotation.Table;
  
  @Table(name = TriviaSQLiteHelper.TABLE_USERS)
  public class User extends Model implements Serializable, Comparable&lt;User&gt;{
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
      @Column(name = TriviaSQLiteHelper.COLUMN_USER_NAME)
      private String username;
      @Column(name = TriviaSQLiteHelper.COLUMN_FIRST_NAME)
      private String first_name;
      @Column(name = TriviaSQLiteHelper.COLUMN_LAST_NAME)
      private String last_name;
      @Column(name = TriviaSQLiteHelper.COLUMN_PASSWORD)
      private String password;
  
      public User(){
          super();
          this.username="";
          this.first_name="";
          this.last_name="";
          this.password="";
      }
  
      public User(String username, String password, String firstName, String lastName){
          super();
          this.username = username;
          this.password = password;
          this.first_name = firstName;
          this.last_name = lastName;
      }
  
  
      public String getFirst_name() {
          return first_name;
      }
  
      public void setFirst_name(String first_name) {
          this.first_name = first_name;
      }
  
      public String getLast_name() {
          return last_name;
      }
  
      public void setLast_name(String last_name) {
          this.last_name = last_name;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      @Override
      public String toString(){
          return this.first_name + " " + this.last_name;
      }
  
  
      public String getUsername() {
          return username;
      }
  
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      @Override
      public int compareTo(User arg0) {
          return this.username.compareTo(arg0.username);
      }
  }
  </code></pre>
  
  <p>Here is the method to insert a new user:</p>
  
  <pre><code>public User insertUser(String username, String password, String firstName, String lastName){
          User newUser = new User(username, password, firstName, lastName);
          newUser.save();
          return newUser;
      }
  </code></pre>
  
  <p>This is my manifest:</p>
  
  <pre><code>&lt;!--
    Copyright 2013 The Android Open Source Project
  
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
  
        http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  --&gt;
  
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="ro.adrian.trivia"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="17"
          android:targetSdkVersion="19" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name" &gt;
          &lt;meta-data
              android:name="AA_DB_NAME"
              android:value="trivia.db" /&gt;
          &lt;meta-data
              android:name="AA_DB_VERSION"
              android:value="1" /&gt;
  
          &lt;activity
              android:name="ro.adrian.trivia.activities.HomeActivity"
              android:label="@string/app_name"
              android:theme="@style/noAnimTheme" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="ro.adrian.trivia.activities.MainActivity"
              android:theme="@style/noAnimTheme" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Here i try to insert a new user:</p>
  
  <pre><code>UserDataSource.getInstance().insertUser("adi", "123", "Adrian", "Olar");
  </code></pre>
  
  <p>And this is the logcat:</p>
  
  <pre><code>01-02 14:56:08.818: E/AndroidRuntime(10129): FATAL EXCEPTION: main
  01-02 14:56:08.818: E/AndroidRuntime(10129): Process: ro.adrian.trivia, PID: 10129
  01-02 14:56:08.818: E/AndroidRuntime(10129): java.lang.NullPointerException
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at com.activeandroid.Cache.getTableInfo(Cache.java:146)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at com.activeandroid.Model.&lt;init&gt;(Model.java:50)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at ro.adrian.trivia.datamodel.User.&lt;init&gt;(User.java:36)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at ro.adrian.trivia.database.UserDataSource.insertUser(UserDataSource.java:31)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at ro.adrian.trivia.fragments.LoginFragment$1.onClick(LoginFragment.java:31)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at android.view.View.performClick(View.java:4438)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at android.view.View$PerformClick.run(View.java:18422)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at android.os.Handler.handleCallback(Handler.java:733)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at android.os.Handler.dispatchMessage(Handler.java:95)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at android.os.Looper.loop(Looper.java:136)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at android.app.ActivityThread.main(ActivityThread.java:5017)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at java.lang.reflect.Method.invoke(Method.java:515)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  01-02 14:56:08.818: E/AndroidRuntime(10129):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I honestly have no idea what could be wrong with my code... any suggestion highly appreciated!</p>