Showing posts from May, 2018

Android thread coordination and network retry

While we have no shortage of API's and data-structures on a moderne Android stack and generally should favor those, occasionally we need to resort to low-level Java constructs to get work done - this is particularly true for thread and concurrency stuff. Main thread waiting for background thread On Android, if on background/worker thread, while you need to schedule work for main/UI thread and wait for it to complete before doing other work on background/worker thread: class SomeBackgroundWorker{            final CountDownLatch latch = new CountDownLatch(1);              private void someBackgroundWorkerMethod(){                  // 1) Post work to UI thread              activity.runOnUiThread(new Runnable() {                          @Override public void run() {                                try {                                      // 1) Do some where here on UiThread                                 } finally {                                       //

Google I/O '18 Developer News

Disclaimer: The following content is based on personal recollections and interpretations and may therefore be incomplete or faulty. Attendance was funded by me as a private individual so views and opinions do not reflect those of my employer. Content licensed under Creative Commons (CC BY) Casper Bang. A few days ago I wrote about the Google I/O 2018 keynote which is not particular technical and is primarily addressing the general tech public (managers, journalists and the like). Most of I/O revolves around much deeper content of course, split between technical talks, office hours, sandboxes, expositions etc. and below I will try to summarize on this - if you are NOT a developer, this may not be for you. Android JetPack This was a brand new term being presented to us at the Developer Keynote on day one, as there weren't even hints of this in the Google I/O app nor on the schedule. While initially somewhat confusing, after having spent 3 days with sessions and talking to Go