This is the code I have:
for (SearchData searchData1 : searchDataTemp){
Log.i("", "test is favourite searchdata:" + searchData1.getIs_favorite() + "..name: " + searchData1.getTitle());
}
Realm realm = Realm.getInstance(getActivity());
realm.beginTransaction();
List<SearchData> managedSeachData = realm.copyToRealmOrUpdate(searchDataTemp);
realm.commitTransaction();
for (SearchData searchData1 : managedSeachData) {
Log.i("", "test is favourite searchdata:" + searchData1.getIs_favorite() + "..name: " + searchData1.getTitle());
user.getRecents().add(searchData1);
}
This is what I get for the normal list in my logs:
test is favourite searchdata:true..name: Vondelpark
This is what I get for the managed Realmlist in my logs:
test is favourite searchdata:false..name: Vondelpark
Any ideea how this can be fixed?
PS: This is my SearchData model:
public class SearchData extends RealmObject{
@PrimaryKey
private String id;
private String title;
private String subtitle;
private String reference;
private String place_id;
private boolean is_favorite;
private int timestamp;
private String last_travel_mode;
private Geometry geometry;
private double distance;
private boolean close;
private int visited_count;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSubtitle() {
return subtitle;
}
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getPlace_id() {
return place_id;
}
public void setPlace_id(String place_id) {
this.place_id = place_id;
}
public boolean getIs_favorite() {
return is_favorite;
}
public void setIs_favorite(boolean is_favorite) {
this.is_favorite = is_favorite;
}
public int getTimestamp() {
return timestamp;
}
public void setTimestamp(int timestamp) {
this.timestamp = timestamp;
}
public String getLast_travel_mode() {
return last_travel_mode;
}
public void setLast_travel_mode(String last_travel_mode) {
this.last_travel_mode = last_travel_mode;
}
public Geometry getGeometry() {
return geometry;
}
public void setGeometry(Geometry geometry) {
this.geometry = geometry;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
public boolean isClose() {
return close;
}
public void setClose(boolean close) {
this.close = close;
}
public boolean is_favorite() {
return is_favorite;
}
public int getVisited_count() {
return visited_count;
}
public void setVisited_count(int visited_count) {
this.visited_count = visited_count;
}
public SearchData() {
}
public SearchData(String id, String title, String subtitle, String reference, String place_id, boolean is_favorite, int timestamp, String last_travel_mode , int visited_count){
this.id = id;
this.title = title;
this.subtitle = subtitle;
this.reference = reference;
this.place_id = place_id;
this.is_favorite = is_favorite;
this.timestamp = timestamp;
this.last_travel_mode = last_travel_mode;
this.visited_count = visited_count;
}
public SearchData(String id, String title, String subtitle, String reference, String place_id, boolean is_favorite, int timestamp, String last_travel_mode, Geometry geometry , int visited_count){
this.id = id;
this.title = title;
this.subtitle = subtitle;
this.reference = reference;
this.place_id = place_id;
this.is_favorite = is_favorite;
this.timestamp = timestamp;
this.last_travel_mode = last_travel_mode;
this.geometry = geometry;
this.visited_count = visited_count;
}
}