You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In which task and step of the codelab can this issue be found?
The problem occurs in the finished code
Describe the problem
It does not matter which marker you click on, the same window is shown.
Steps to reproduce?
Download and open the 'solution' project
Build and run (on either a real phone or an emulator)
Once some markers appear, click on one. The window for the first place in the places list is shown.
Click on another marker, the same window is shown.
Versions
_Android Studio version:4.2.2
_API version of the emulator:N/A
Additional information
I think that the reason for this is that the equals function in Place.kt is checking whether the 'id' is the same.
However the place 'id' in the places that you get from the PlacesService is always null (see screenshot of debug session)
The data from the PlacesService does include a 'place_id'. For example: "place_id" : "ChIJPw9ldbW1h0gRtro8aWp99fU",
If Place.kt is changed so that the id attribute is 'place_id' rather than 'id' and the equality check is changed to match, i.e.
data class Place(
val place_id: String,
val icon: String,
val name: String,
val geometry: Geometry
) {
override fun equals(other: Any?): Boolean {
if (other !is Place) {
return false
}
return this.place_id == other.place_id
}
override fun hashCode(): Int {
return this.place_id.hashCode()
}
}
the correct window is shown when you click on the marker.
The text was updated successfully, but these errors were encountered:
URL of codelab
https://developers.google.com/codelabs/maps-platform/location-places-arcore-android#2
In which task and step of the codelab can this issue be found?
The problem occurs in the finished code
Describe the problem
It does not matter which marker you click on, the same window is shown.
Steps to reproduce?
Versions
_Android Studio version:4.2.2
_API version of the emulator:N/A
Additional information
I think that the reason for this is that the equals function in Place.kt is checking whether the 'id' is the same.
However the place 'id' in the places that you get from the PlacesService is always null (see screenshot of debug session)
The data from the PlacesService does include a 'place_id'. For example:
"place_id" : "ChIJPw9ldbW1h0gRtro8aWp99fU",
If Place.kt is changed so that the id attribute is 'place_id' rather than 'id' and the equality check is changed to match, i.e.
data class Place(
val place_id: String,
val icon: String,
val name: String,
val geometry: Geometry
) {
override fun equals(other: Any?): Boolean {
if (other !is Place) {
return false
}
return this.place_id == other.place_id
}
}
the correct window is shown when you click on the marker.
The text was updated successfully, but these errors were encountered: