I learn Android Studio and I try to improve my Java level with your book
“Android programming. The big Nerd Ranch Guide”, 3rd edition.
This book was translated and published by Russian in 2017 by Piter Publishing House (www.piter.com)
I have read some chapters of this book and I have received so problem in my code.
I cannot see a properly clicked item in the new activity “CrimePagerActivity” from RecycleView.
I can see another item from the list in this new activity (ViewPager).
I have found this issue here, in this row of code:
Intent intent = CrimePagerActivity.newIntent(getActivity(), mCrime.getId());
I receive an incorrect item from “mCrime.getId()”.
Unfortunately, I do not know how to fix it.
Maybe someone can help me?
My code and my some layouts are below.
Crime.java
package com.bignerdranch.android.criminalintent;
import java.util.Date;
import java.util.UUID;
public class Crime{
private UUID mId;
private String mTitle;
private Date mDate;
private boolean mSolved;
private boolean mRequiresPolice;
public Crime() {
// Generate unique identifier
this(UUID.randomUUID());
}
public Crime(UUID id) {
mId = id;
mDate = new Date();
}
public UUID getId() {
return mId;
}
public String getTitle() {
return mTitle;
}
public void setTitle(String title) {
mTitle = title;
}
public Date getDate() {
return mDate;
}
public void setDate(Date date) {
mDate = date;
}
public boolean isSolved() {
return mSolved;
}
public void setSolved(boolean solved) {
mSolved = solved;
}
public boolean isRequiresPolice() {
return mRequiresPolice;
}
public void setRequiresPolice(boolean requiresPolice) {
mRequiresPolice = requiresPolice;
}
}
===============================================================