burhanloey / waktu-solat

Prayer times for Malaysia fetched from e-Solat Portal
BSD 2-Clause "Simplified" License
0 stars 1 forks source link

Strange "Fetch" behavior #5

Closed burhanloey closed 5 years ago

burhanloey commented 5 years ago

On Android device, during fetching, the prayer time seems to been fetched, but on loading, it only update Subuh prayer time. After killing the app and restart, only then all prayer times are loaded.

This doesn't occur when tested in emulator. Could have been racing condition because device being slower?

burhanloey commented 5 years ago

Fixed by pull request #6

burhanloey commented 5 years ago

Previously the callback runs on different thread when it should be on ui thread. Also, ExecutorService seems to be not suitable for this, changed to Thread which is the same as AsyncTask.

burhanloey commented 5 years ago

The code looks ugly though because of clusters of anonymous class. I wish I used lambda interface in the first place. Welp.