title: java.lang.NullPointerException:Attempt to invoke virtual method 'java.lang.String com.data.model.Address.getShortAddress()' on null object reference
body: <p>I am new to android and trying to create one simple application.However, i am getting nullpointerexception error and don't have much knowledege about it.</p>
  <p>Error i got:</p>
  <p>java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.jstechnologies.helpinghands.data.model.Address.getShortAddress()' on a null object reference</p>
  <pre><code>   at com.jstechnologies.helpinghands.ui.views.dashBoard.DashBoardActivity$5.onChanged(DashBoardActivity.java:113)
      at com.jstechnologies.helpinghands.ui.views.dashBoard.DashBoardActivity$5.onChanged(DashBoardActivity.java:110)
  </code></pre>
  <p><strong>DashBoardActivity.java</strong></p>
  <pre><code>package com.jstechnologies.helpinghands.ui.views.dashBoard;
  
  
  
  public class DashBoardActivity extends BaseActivity&lt;DashBoardViewModel&gt; {
  
      LinearLayout tagsView;
      TextView dealers_viewall,location;
      ExtendedFloatingActionButton fab;
      ShimmerFrameLayout shimmerFrameLayout;
      RecyclerView dealersRecyclerView;
      ServiceAdapter serviceAdapter;
      Toolbar toolbar;
      int h=0;
  
      private static int RC_ADD_SERVICE=101;
      private static int RC_SERVICE_DISPLAY=102;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_dashboard);
          registerViewComponents();
          setSupportActionBar(toolbar);
          viewmodel.fetchAddress(this);
          viewmodel.fetchData();
      }
  
      @NonNull
      @Override
      protected DashBoardViewModel createViewModel() {
          DashBoardViewModelFactory viewModelFactory= new DashBoardViewModelFactory(ServiceRepository.getInstance());
          return new ViewModelProvider(this,viewModelFactory).get(DashBoardViewModel.class);
      }
  
      @Override
      protected void onMessage(String message) {
          Toast.makeText(this,message,Toast.LENGTH_SHORT).show();
      }
  
      @Override
      protected void observe() {
  
          viewmodel.getIsLoadingLiveData().observe(this, new Observer&lt;Boolean&gt;() {
              @Override
              public void onChanged(Boolean aBoolean) {
                  if(aBoolean)
                      serviceAdapter.setModels(new ArrayList&lt;&gt;());
                  shimmerFrameLayout.setVisibility(aBoolean?View.VISIBLE:View.GONE);
              }
          });
  
          viewmodel.getMessageLiveData().observe(this, new Observer&lt;String&gt;() {
              @Override
              public void onChanged(String s) {
                 onMessage(s);
              }
          });
          viewmodel.getRepositoryMessage().observe(this, new Observer&lt;String&gt;() {
              @Override
              public void onChanged(String s) {
                  onMessage(s);
              }
          });
          viewmodel.getServicesListLiveData().observe(this, new Observer&lt;List&lt;ServiceModel&gt;&gt;() {
              @Override
              public void onChanged(List&lt;ServiceModel&gt; serviceModels) {
                  serviceAdapter.setModels(serviceModels);
              }
          });
          viewmodel.getAddressLiveData().observe(this, new Observer&lt;Address&gt;() {
              @Override
              public void onChanged(Address address) {
                  location.setText(address.getShortAddress());
              }
          });
      }
  
      void registerViewComponents() {
          location=findViewById(R.id.location);
          dealers_viewall = findViewById(R.id.dealers_viewall);
          tagsView = findViewById(R.id.tagView);
          shimmerFrameLayout = findViewById(R.id.shimmer_view_container);
          fab = findViewById(R.id.fab);
          dealersRecyclerView = findViewById(R.id.recycler_dealers);
          serviceAdapter= new ServiceAdapter();
          dealersRecyclerView.setLayoutManager(new LinearLayoutManager(this));
          dealersRecyclerView.setAdapter(serviceAdapter);
          fab.shrink();
          toolbar=findViewById(R.id.toolbar);
          dealers_viewall.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  startActivity(new Intent(DashBoardActivity.this, SearchableActivity.class));
              }
          });
          serviceAdapter.setOnItemClickListener(new ServiceAdapter.OnItemClickListener() {
              @Override
              public void OnItemClick(ServiceModel dealer, int index) {
                  startActivityForResult(getSelectedIntentFor(dealer),RC_SERVICE_DISPLAY);
              }
          });
  
      }
  
      public void onMenuClick(View view) {
      }
  
      public void onfabClick(View view) {
          startActivityForResult(getAddServiceIntent(),RC_ADD_SERVICE);
      }
  
      private Intent getAddServiceIntent()
      {
          return new Intent(this, AddServiceActivity.class);
      }
      private Intent getSelectedIntentFor(ServiceModel model)
      {
          Intent intent= new Intent(this,ServiceDisplayActivity.class);
          intent.putExtra(&quot;service_data&quot;,new Gson().toJson(model));
          return intent;
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if(resultCode==RESULT_OK)
              viewmodel.fetchData();
      }
  
  
      public void onRefreshClick(View view) {
          viewmodel.fetchData();
      }
  </code></pre>