7.1 AsyncTask and AsyncTaskLoader.pptx - Android Developer Fundamentals Background Tasks Lesson 7 Android Developer Fundamentals AsyncTask This work is

7.1 AsyncTask and AsyncTaskLoader.pptx - Android Developer...

This preview shows page 1 - 13 out of 44 pages.

Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask 1 Background Tasks Lesson 7 Android Developer Fundamentals
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask 7.1 AsyncTask & AsyncTaskLoader 2
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask Contents Threads AsyncTask Loaders AsyncTaskLoader 3
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask Threads 4
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask The main thread Independent path of execution in a running program Code is executed line by line App runs on Java thread called "main" or "UI thread" Draws UI on the screen Responds to user actions by handling UI events 5
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask The Main thread must be fast Hardware updates screen every 16 milliseconds UI thread has 16 ms to do all its work If it takes too long, app stutters or hangs 6 WAIT
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask Users uninstall unresponsive apps If the UI waits too long for an operation to finish, it becomes unresponsive The framework shows an Application Not Responding (ANR) dialog 7
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask 8 What is a long running task? Network operationsLong calculations Downloading/uploading files Processing images Loading data
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask Background threads Execute long running tasks on a background thread AsyncTask The Loader Framework Services 9 Main Thread (UI Thread) Worker Thread Do some work Update UI
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask Two rules for Android threads Do not block the UI thread Complete all work in less than 16 ms for each screen Run slow non-UI work on a non-UI thread Do not access the Android UI toolkit from outside the UI thread Do UI work only on the UI thread 10
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask AsyncTask 11
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-Non Commercial 4.0 International Lic ense AsyncTask What is AsyncTask?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture