title: Unable to add Observer or java.lang.NullPointerException at java.util.Observable.addObserver(Observable.java:55)
body: <p>I am basically making my effort to add an observer to '<code>MUserData.ProfileDetails</code>' from ,View_profile Activity' but i am unable to achieve it, it always gives me crash or error in '<code>View_profile</code>' <code>at line 24</code>, any help would be appreciated.</p>
  
  <p>My logcat is as follows,</p>
  
  <pre><code>    /***********************log or crash report**************************/
  
       Caused by: java.lang.NullPointerException                                                       at java.util.Observable.addObserver(Observable.java:55)                                                    at cl.click.ui.activities.View_Profile.initialize(View_Profile.java:24)                 at cl.click.ui.activities.View_Profile.onCreate(View_Profile.java:18)
      at android.app.Activity.performCreate(Activity.java:5231)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  
      /*****************************MUserData*********************************/
      My Modal class is as follows,
  
      package cl.click.utility.modals;
  
      import com.fasterxml.jackson.annotation.JsonProperty;
      import com.fasterxml.jackson.annotation.JsonPropertyOrder;
  
      import java.util.ArrayList;
      import java.util.HashMap;
      import java.util.List;
      import java.util.Map;
      import java.util.Observable;
  
      @JsonPropertyOrder({
              "data"
      })
      public class MUserData {
  
  @JsonProperty("data")
  private ProfileDetails.Data data;
  
  @JsonProperty("data")
  public ProfileDetails.Data getData() {
      return data;
  }
  
  @JsonProperty("data")
  public void setData(ProfileDetails.Data data) {
      this.data = data;
  }
  
  @JsonInclude(JsonInclude.Include.NON_NULL)
  @JsonPropertyOrder({
          "description"
  })
  public class ProfileDetails extends Observable 
  {
      @JsonProperty("description")
      private String description;
      @JsonProperty("description")
      public String getDescription() {
          return description;
      }
      @JsonProperty("description")
      public void setDescription(String description) {
          this.description = description;
      }
      public void setODescription(String description) {
          this.description=description;
          notifyChange(description);
      }
  }
   @JsonInclude(JsonInclude.Include.NON_NULL)
      @JsonPropertyOrder({
              "profileDetails"
      })
      public class Data {
          @JsonProperty("profileDetails")
          private ProfileDetails profileDetails;
          @JsonProperty("profileDetails")
          public ProfileDetails getProfileDetails() {
              return profileDetails;
          }
          @JsonProperty("profileDetails")
          public void setProfileDetails(ProfileDetails profileDetails) {
              this.profileDetails = profileDetails;
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>    /****************************View_Profile******************************/
  
  
       package cl.click.ui.activities;
          import android.support.v7.app.AppCompatActivity;
  
          import java.util.Observable;
          import java.util.Observer;
  
          import cl.click.ApplicationClass;
          import cl.click.R;
          import cl.click.utility.modals.MUserData;
  
          public class View_Profile extends AppCompatActivity implements Observer
          {
              @Override
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_profile_view);
  
                  initialize();
              }
  
              private final void initialize()
              {
                  MUserData.ProfileDetails profileDetails=((ApplicationClass)getApplicationContext()).getProfileDetails();
                  profileDetails.addObserver(this);           //Error here on setting the observer
              }
  
              @Override
              public void update(Observable observable, Object data) {
                  LogUtil.e("data is:-",data.toString());
              }
          }
  
  /****************************ApplicationClass******************************/
  
      package cl.click;
  
      import android.app.Application;
  
      import java.util.Observable;
      import java.util.Observer;
  
      import cl.click.utility.modals.MUserData;
      public class ApplicationClass extends Application
      {
          private MUserData.ProfileDetails profileDetails;
  
          @Override
          public void onCreate() {
              super.onCreate();
              profileDetails=new MUserData().new ProfileDetails();
          }
  
          public MUserData.ProfileDetails getProfileDetails() {
              return profileDetails;
          }
  
          public void setProfileDetails(MUserData.ProfileDetails profileDetails) {
              this.profileDetails = profileDetails;
          }
  
      }
  </code></pre>