11.7 uuid


#1

I am a bit confused and can not seem to figure out how to fix this.

I have this line in the code:
UUID crimeId = (UUID)getIntent().getSerializableExtra(CrimeFragment.EXTRA_CRIME_ID);

When I print out the UUID here I get: 4b3981b8-91f1-4eff-8e88-8d622a998065

Clearly this is not what I am looking for. Do I potentially have code wrong somewhere else or is this in errata?

Thank you for any help.


#2

This seems correct. Why are you printing the UUID? It is supposed to be a unique random identifier, and not user-visible. In that section of the code you should be using the UUID to find the correct crime, by CrimeLab.get(getActivity()).getCrime(crimeId).


#3

Thank you very much!

I had printed the UUID to debug.

I had missed the .getId() here: if (mCrimes.get(i).getId().equals(crimeId)) so it was comparing the UUID to 0-mCrime.size(), I was focusing on the wrong thing. Knowing the first part was right let me focus on the second piece. Thank you.