The final fix to update in your map pin marker the annotation that you made:
Map PIN is not refreshing with the current data in the PIN marker annotation panel:
✅ the marker title updates
✅ the snippet updates
✅ the info window refreshes
(and editing it again shows the saved text)
✅ FINAL FIX — The Map Must Refresh After Edit
The edits ARE being saved, but the marker UI does NOT automatically refresh.
We fix this by:
⭐ Calling reloadMarkers() inside onResume() of MainActivity
When the user presses SAVE, Android returns to MainActivity → onResume() fires → we redraw markers.
✅ STEP 1 — Add reloadMarkers() in MainActivity
Paste this anywhere inside MainActivity, outside other functions:
// ---------------------------------------------------------
// 🔁 RELOAD ALL MARKERS AFTER EDIT SCREEN
// ---------------------------------------------------------
private fun reloadMarkers() {
googleMap.clear()
for (s in sightings) {
addMarker(s)
}
}
✅ STEP 2 — In MainActivity, override onResume()
Paste this:
override fun onResume() {
super.onResume()
if (::googleMap.isInitialized) {
reloadMarkers()
}
}
✅ STEP 3 — EditSightingActivity remains the same
No changes needed — your SAVE button already updates the object in memory.
⭐ Now what happens?
1️⃣ User taps marker → opens editor screen
2️⃣ They update “wiley fox” or notes
3️⃣ They press SAVE → Activity finishes
4️⃣ Android returns to MainActivity
5️⃣ onResume() automatically runs
6️⃣ We clear all markers and re-add them
7️⃣ Updated title/snippet now appear immediately
🚀 Result — No need to tap the marker twice
✔ The edit appears instantly ✔ Stable, simple, perfect for class ✔ Students can easily understand the flow