title: Frustrating App Crash
body: <p>Having previously had my application working <em>perfectly</em>, it now continually crashes now that I have attempted to add extra, but almost identical functionally. By extra functionality I mean Edit Texts, Spinners, etc.  This is hugely frustrating, as it clearly is something very small that seems to be the issue.</p>
  
  <p>My <code>LogCat</code> is showing that there is an error on Line 114 of my Property class, however, I can't understand why this would be an issue as it did not affect the application before added functionality was implemented.</p>
  
  <p><strong>LogCat</strong> </p>
  
  <pre><code>    02-26 21:19:20.424 9478-9478/com.example.benchalmers.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                       Process: com.example.benchalmers.myapplication, PID: 9478
                                                                                       com.google.firebase.database.DatabaseException: Class com.example.benchalmers.myapplication.Property does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped.
                                                                                           at com.google.android.gms.internal.zzelx.zze(Unknown Source:51)
                                                                                           at com.google.android.gms.internal.zzelw.zzb(Unknown Source:772)
                                                                                           at com.google.android.gms.internal.zzelw.zza(Unknown Source:0)
                                                                                           at com.google.firebase.database.DataSnapshot.getValue(Unknown Source:10)
                                                                                           at com.example.benchalmers.myapplication.PropertyActivity$4.onDataChange(PropertyActivity.java:114)
                                                                                           at com.google.android.gms.internal.zzegf.zza(Unknown Source:13)
                                                                                           at com.google.android.gms.internal.zzeia.zzbyc(Unknown Source:2)
                                                                                           at com.google.android.gms.internal.zzeig.run(Unknown Source:65)
                                                                                           at android.os.Handler.handleCallback(Handler.java:790)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                           at android.os.Looper.loop(Looper.java:164)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
  02-26 21:19:20.425 9478-9478/com.example.benchalmers.myapplication E/UncaughtException: com.google.firebase.database.DatabaseException: Class com.example.benchalmers.myapplication.Property does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped.
                                                                                              at com.google.android.gms.internal.zzelx.zze(Unknown Source:51)
                                                                                              at com.google.android.gms.internal.zzelw.zzb(Unknown Source:772)
                                                                                              at com.google.android.gms.internal.zzelw.zza(Unknown Source:0)
                                                                                              at com.google.firebase.database.DataSnapshot.getValue(Unknown Source:10)
                                                                                              at com.example.benchalmers.myapplication.PropertyActivity$4.onDataChange(PropertyActivity.java:114)
                                                                                              at com.google.android.gms.internal.zzegf.zza(Unknown Source:13)
                                                                                              at com.google.android.gms.internal.zzeia.zzbyc(Unknown Source:2)
                                                                                              at com.google.android.gms.internal.zzeig.run(Unknown Source:65)
                                                                                              at android.os.Handler.handleCallback(Handler.java:790)
                                                                                              at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                              at android.os.Looper.loop(Looper.java:164)
                                                                                              at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                                              at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
  </code></pre>
  
  <p>Previous to making these changes, I was able to add, update and delete records perfectly, with no hiccups whatsoever. This is what leads me to believe that the issues I'm having are easily fixed.</p>
  
  <p>At the moment the screen loads up for 1 second and then it crashes almost immediately.</p>
  
  <p>I have made small changes to variable names etc. thinking that that might help, but to no avail.</p>
  
  <p>Any help on this would be much appreciated.  I'm very new at Android, and with Stack! First Post!</p>
  
  <p><strong>PropertyActivity.java</strong></p>
  
  <pre><code>    package com.example.benchalmers.myapplication;
  
  import android.content.Intent;
  import android.support.v7.app.AlertDialog;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.text.TextUtils;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ListView;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.database.ValueEventListener;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class PropertyActivity extends AppCompatActivity {
  
      public static final String PROPERTY_NAME = "propertyname";
      public static final String PROPERTY_ID = "propertyid";
  
      EditText editTextProperty;
      EditText editTextPostcode;
      EditText editTextBedrooms;
      EditText editTextBathrooms;
      Button buttonAddProperty;
      Spinner spinnerFuel;
      Spinner spinnerStatus;
      Spinner spinnerEPC;
  
      DatabaseReference databaseProperties;
  
      ListView listViewProperties;
  
      List&lt;Property&gt; propertyList;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_property);
  
          databaseProperties = FirebaseDatabase.getInstance().getReference("properties");
  
          editTextProperty = (EditText) findViewById(R.id.editTextProperty);
          editTextPostcode = (EditText) findViewById(R.id.editTextPostcode);
          editTextBedrooms = (EditText) findViewById(R.id.editTextBedrooms);
          editTextBathrooms = (EditText) findViewById(R.id.editTextBathrooms);
          buttonAddProperty = (Button) findViewById(R.id.buttonAddProperty);
          spinnerStatus = (Spinner) findViewById(R.id.spinnerStatus);
          spinnerEPC = (Spinner) findViewById(R.id.spinnerEPC);
          spinnerFuel = (Spinner) findViewById(R.id.spinnerFuel);
  
          listViewProperties = (ListView) findViewById(R.id.listViewProperties);
  
          propertyList = new ArrayList&lt;&gt;();
  
          buttonAddProperty.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  addProperty();
  
              }
          });
  
          listViewProperties.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) {
  
                  Property property = propertyList.get(position);
                  Intent intent = new Intent(getApplicationContext(), AddTenantsActivity.class);
  
                  intent.putExtra(PROPERTY_ID, property.getPropertyId());
                  intent.putExtra(PROPERTY_NAME, property.getPropertyAddress());
  
                  startActivity(intent);
              }
          });
  
          listViewProperties.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
              @Override
              public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                  Property property = propertyList.get(position);
  
                  showUpdateDialog(property.getPropertyId(), property.getPropertyAddress(), property.getPropertyPostcode(), property.getPropertyBedrooms(), property.getPropertyBathrooms(), property.getPropertyStatus(), property.getPropertyEPC(), property.getPropertyFuel());
                  return false;
              }
          });
      }
  
      @Override
      protected void onStart() {
          super.onStart();
  
          databaseProperties.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
  
                  propertyList.clear();
  
                  for(DataSnapshot propertySnapshot : dataSnapshot.getChildren()){
                      Property property = propertySnapshot.getValue(Property.class);
  
                      propertyList.add(property);
  
                  }
  
                  PropertyList adapter = new PropertyList (PropertyActivity.this, propertyList);
                  listViewProperties.setAdapter(adapter);
  
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
      }
  
      private void showUpdateDialog(final String id, String propertyAddress, String propertyPostcode, String propertyBedrooms, String propertyBathrooms, String propertyStatus, final String propertyId, String propertyName) {
  
          AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
  
          LayoutInflater inflater = getLayoutInflater();
  
          final View dialogView = inflater.inflate(R.layout.update_dialog, null);
  
          dialogBuilder.setView(dialogView);
  
          final EditText editTextName = (EditText) dialogView.findViewById(R.id.editTextName);
          final Button buttonUpdate = (Button) dialogView.findViewById(R.id.buttonUpdate);
          final Spinner spinnerFuel = (Spinner) dialogView.findViewById(R.id.spinnerFuel);
          final Button buttonDelete = (Button) dialogView.findViewById(R.id.buttonDelete);
  
          dialogBuilder.setTitle("Updating Property " + propertyName);
  
          final AlertDialog alertDialog = dialogBuilder.create();
          alertDialog.show();
  
          buttonUpdate.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  String name = editTextName.getText().toString().trim();
                  String postcode = editTextPostcode.getText().toString().trim();
                  String bedrooms = editTextBedrooms.getText().toString().trim();
                  String bathrooms = editTextBathrooms.getText().toString().trim();
                  String status = spinnerStatus.getSelectedItem().toString();
                  String epc = spinnerEPC.getSelectedItem().toString();
                  String fuel = spinnerFuel.getSelectedItem().toString();
  
                  if(TextUtils.isEmpty(name)){
  
                      editTextName.setError("Name Required");
                      return;
                  }
  
                  updateProperty(propertyId, status, postcode, bedrooms, bathrooms, id, name, epc, fuel);
  
                  alertDialog.dismiss();
              }
          });
  
          buttonDelete.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  deleteProperty(propertyId);
              }
          });
  
      }
  
      private void deleteProperty(String propertyId) {
          DatabaseReference drProperty = FirebaseDatabase.getInstance().getReference("properties").child(propertyId);
          DatabaseReference drTenants = FirebaseDatabase.getInstance().getReference("tenants").child(propertyId);
  
          drProperty.removeValue();
          drTenants.removeValue();
  
          Toast.makeText(this, "Property has been deleted", Toast.LENGTH_LONG).show();
  
      }
  
      private boolean updateProperty(String propertyId, String status, String postcode, String bedrooms, String bathrooms, String id, String name, String epc, String fuel){
  
          DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("properties").child(id);
          Property property = new Property (id, name, postcode, bedrooms, bathrooms, status, epc, fuel);
  
          databaseReference.setValue(property);
  
          Toast.makeText(this, "Property Updated Successfully", Toast.LENGTH_LONG).show();
  
          return true;
      }
  
      private void addProperty(){
  
          String address = editTextProperty.getText().toString().trim();
          String postcode = editTextPostcode.getText().toString().trim();
          String bedrooms = editTextBedrooms.getText().toString().trim();
          String bathrooms = editTextBathrooms.getText().toString().trim();
          String status = spinnerStatus.getSelectedItem().toString();
          String epc = spinnerEPC.getSelectedItem().toString();
          String fuel = spinnerFuel.getSelectedItem().toString();
  
          if(!TextUtils.isEmpty(address)){
  
              String id = databaseProperties.push().getKey();
  
              Property property = new Property (id, address, postcode, bedrooms, bathrooms, status, epc, fuel);
  
              databaseProperties.child(id).setValue(property);
  
              Toast.makeText(this, "Property Added", Toast.LENGTH_LONG).show();
  
          }else {
  
              Toast.makeText(this, "You must enter a property", Toast.LENGTH_LONG).show();
          }
  
      }
  }
  </code></pre>
  
  <p><strong>Property.java</strong></p>
  
  <pre><code>package com.example.benchalmers.myapplication;
  
  /**
   * Created by benchalmers on 21/02/2018.
   */
  
  public class Property {
  
      String propertyId;
      String propertyAddress;
      String propertyPostcode;
      String propertyFuel;
      String propertyBedrooms;
      String propertyBathrooms;
      String propertyEPC;
      String propertyStatus;
  
      public Property(String id, String address, String postcode, String bedrooms, String bathrooms, String status, String epc, String fuel ) {
  
          this.propertyId = propertyId;
          this.propertyAddress = propertyAddress;
          this.propertyPostcode = postcode;
          this.propertyFuel = propertyFuel;
          this.propertyBedrooms = bedrooms;
          this.propertyBathrooms = bathrooms;
          this.propertyEPC = epc;
          this.propertyStatus = status;
      }
  
      public String getPropertyId() {
          return propertyId;
      }
  
      public String getPropertyAddress() {
          return propertyAddress;
      }
  
      public String getPropertyPostcode() {
          return propertyPostcode;
      }
  
      public String getPropertyFuel() {
          return propertyFuel;
      }
  
      public String getPropertyBedrooms() {
          return propertyBedrooms;
      }
  
      public String getPropertyBathrooms() {
          return propertyBathrooms;
      }
  
      public String getPropertyEPC() {
          return propertyEPC;
      }
  
      public String getPropertyStatus() {
          return propertyStatus;
      }
  }
  </code></pre>
  
  <p><strong>PropertyList.java</strong></p>
  
  <pre><code>package com.example.benchalmers.myapplication;
  
  import android.app.Activity;
  import android.support.annotation.NonNull;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.TextView;
  
  import java.util.List;
  
  public class PropertyList extends ArrayAdapter&lt;Property&gt; {
  
      private Activity context;
      private List&lt;Property&gt; propertyList;
  
      public PropertyList(Activity context, List&lt;Property&gt; propertyList) {
  
          super(context, R.layout.property_list_layout, propertyList);
          this.context = context;
          this.propertyList = propertyList;
      }
  
      @NonNull
      @Override
      public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
          LayoutInflater inflater = context.getLayoutInflater();
  
          View listViewItem = inflater.inflate(R.layout.property_list_layout, null, true);
  
          TextView textViewProperty = (TextView) listViewItem.findViewById(R.id.textViewProperty);
          TextView textViewPostcode = (TextView) listViewItem.findViewById(R.id.textViewPostcode);
          TextView textViewBedrooms = (TextView) listViewItem.findViewById(R.id.textViewBedrooms);
          TextView textViewBathrooms = (TextView) listViewItem.findViewById(R.id.textViewBathrooms);
          TextView textViewStatus = (TextView) listViewItem.findViewById(R.id.textViewStatus);
          TextView textViewEPC = (TextView) listViewItem.findViewById(R.id.textViewEPC);
          TextView textViewFuel = (TextView) listViewItem.findViewById(R.id.textViewFuel);
  
  
          Property property = propertyList.get(position);
  
          textViewProperty.setText(property.getPropertyAddress());
          textViewPostcode.setText(property.getPropertyPostcode());
          textViewBedrooms.setText(property.getPropertyBedrooms());
          textViewBathrooms.setText(property.getPropertyBathrooms());
          textViewStatus.setText(property.getPropertyStatus());
          textViewEPC.setText(property.getPropertyEPC());
          textViewFuel.setText(property.getPropertyFuel());
  
          return listViewItem;
      }
  }
  </code></pre>