Of course it was a problem with the lifecycle of my activity. When I use ViewTreeObserver.OnGlobalLayoutListener instead of .post, the coordinates are returned perfectly.
ViewTreeObserver.OnGlobalLayoutListener
.post