Cannot resolve symbol "crime"

I can’t figure out the issue of why "crime’ and ‘getID().’ are unresolved.

public class CrimeLab {
private static CrimeLab sCrimeLab;

private List<Crime> mCrimes;


public static CrimeLab get(Context context){
    if (sCrimeLab == null){
        sCrimeLab = new CrimeLab(context);
    }
    return sCrimeLab;
}

private CrimeLab(Context context){
    mCrimes = new ArrayList<>();

    for (int i = 0; i < 100; i++){
        Crime.crime = new Crime();
        crime.setTitle("Crime #" + i);
        crime.setSolved(i % 2 == 0);
        mCrimes.add(crime);
    }
}

public Crime getCrime(UUID id){
    for (Crime crime : mCrimes){
        if (crime.getID().equals(id)){
            return crime;
        }
    }
    return null;
}

}

fixed it, I put Crime.crime instead of Crime Crime

The problem I have not is that the setTitle and setSolved are looking for a method or setter.

getID() is still giving an error

From reading your solution to your problem, does this imply you are only having problems with the getID() function at the moment? Only possibilities I could assume are misspelling the function name, or it doesn’t exist. Could you share the code for the Crime.java file?

Thanks, that solved it. I was using google naming convention for the setTitle and setSolved in Crime but not here.

Glad to hear that your problem is resolved :slight_smile: