-2
   public Crash getCrash() {
    String uuidString = getString(getColumnIndex(CrashTable.Cols.UUID));
    String name = getString(getColumnIndex(CrashTable.Cols.DRIVER1));
    String insCo = getString(getColumnIndex(CrashTable.Cols.INSCO));
    String policy = getString(getColumnIndex(CrashTable.Cols.POLICY));
    String telephone = getString(getColumnIndex(CrashTable.Cols.PHONE));
    String email = getString(getColumnIndex(CrashTable.Cols.EMAIL));

    **Crash crash = new Crash(UUID.fromString(uuidString));**
    crash.setYourName(name);
    crash.setInsCo(insCo);
    crash.setPolicy(policy);
    crash.setTelephone(telephone);
    crash.setEmail(email);

    return crash;
}

The line I marked is causing a NPE (uuid == null). It seems to have problem with the fromString. Here's the pertinent portion of the "Crash" class it's referencing.

public class Crash  {

private UUID mId;
private String mYourName;
private String mInsCo;
private String mPolicy;
private String mTelephone;
private String mEmail;
private Date mDate;

public Crash() {
    this(UUID.randomUUID());
}

public Crash(UUID id) {
    mId = id;
    mDate = new Date();
}

public UUID getId() {
    return mId;
}

Is there something I'm missing? I'm pretty new to this, so if there's some more information you're needing, please let me know. Thanks in advance.

kblank85
  • 7
  • 2

1 Answers1

0

Check whether the uuid string that you are passing in is not null.

If it is not null, check the format of uuid string that you are using.

Example for a UUID conversion :

// creating UUID      
UUID uid = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Eldhose M Babu
  • 14,382
  • 8
  • 39
  • 44