What is there cleaner whay of storing a RealmObject that contains a Google\'s LatLng object int Realm?
Area {
Latlat coord;
String name
}
You can create Model like this which is in java :
public class ActionDataModel extends RealmObject
{
private LocationDataModel targetLatLong;
@NonNull
public LatLng getTargetLatLong()
{
return new LatLng(targetLatLong.getLatitude(), targetLatLong.getLongitude());
}
public void setTargetLatLong(@NonNull LatLng targetLatLong)
{
this.targetLatLong = new LocationDataModel(targetLatLong);
}
}
Here is the parent model which is in kotlin :
open class LocationDataModel(latLng: LatLng? = null)
: RealmObject() {
var latitude = latLng?.latitude
var longitude = latLng?.longitude
}