https://forums.bignerdranch.com/t/nullpointer-runtime-error-on-clicking-new-crime/8016/2
Solution to your issue.
Change the Boolean to boolean in your Crime.java
https://forums.bignerdranch.com/t/nullpointer-runtime-error-on-clicking-new-crime/8016/2
Solution to your issue.
Change the Boolean to boolean in your Crime.java
Do I create a setter for setCrimes()?
Please try the suggestion as the above link first in Crime.java, which was also mentioned by lscodex.
If it doesn’t work, then try the following update.
private void updateUI() {
CrimeLab crimeLab = CrimeLab.getInstance(getActivity());
List<Crime> crimes = crimeLab.getCrimes();
if (mCrimeAdapter == null) {
mCrimeAdapter = new CrimeAdapter(crimes);
mCrimeRecyclerView.setAdapter(mCrimeAdapter);
} else {
mCrimeAdapter.setCrimes(crimes); // add this line
mCrimeAdapter.notifyDataSetChanged();
}
}
private class CrimeAdapter extends RecyclerView.Adapter<CrimeHolder> {
// ......
public void setCrimes(List<Crime> crimes) {
mCrimes = crimes;
}
// ......
}
Yes It is working. I just realized the difference between my Boolean and iscodex’s " boolean. When I made the capital B into lowercase its working perfectly. Thanks a lot, I truly appreciate you both.
In the process I learned the name of the term associated with the error that my "Source code doesn’t match my bytecode through the link iscodex provided. Called "Boxing/and Unboxing’.