Differences

This shows you the differences between two versions of the page.

Link to this comparison view

smd:laboratoare:04 [2021/04/08 12:08]
alexandru.chirvase [Handlers and Runnables]
smd:laboratoare:04 [2021/05/12 17:46] (current)
adriana.draghici [Tasks]
Line 24: Line 24:
 We will also briefly discuss AsyncTasks, which are not recommended and will be deprecated in the next Android release (R). We will also briefly discuss AsyncTasks, which are not recommended and will be deprecated in the next Android release (R).
  
-Because ​the SMD labs' scope do not include learning a new language, we will not address in this lab asynchronous programming using the **[[https://​developer.android.com/​topic/​libraries/​architecture/​coroutines|coroutines]]** provided in **Kotlin**. Nonetheless,​ if you want to learn and code in Kotlin, or are already familiar with it, feel free to use them in your project. Useful video overview: [[https://​www.youtube.com/​watch?​v=BOHK_w09pVA|Understand Kotlin Coroutines on Android (Google I/​O'​19)]]. +<note tip>Because ​this course'scope does not include learning a new language, we will not address in this lab asynchronous programming using the **[[https://​developer.android.com/​topic/​libraries/​architecture/​coroutines|coroutines]]** provided in **Kotlin**. Nonetheless,​ if you want to learn and code in Kotlin, or are already familiar with it, feel free to use them in your project. Useful video overview: [[https://​www.youtube.com/​watch?​v=BOHK_w09pVA|Understand Kotlin Coroutines on Android (Google I/​O'​19)]]. 
 +</​note>​
 Other threading mechanisms you can use and are not covered in this lab: Other threading mechanisms you can use and are not covered in this lab:
   * **Reactive programming** using **[[https://​blog.gojekengineering.com/​multi-threading-like-a-boss-in-android-with-rxjava-2-b8b7cf6eb5e2|RxJava]]** or **RxKotlin** - do not need to explicitly create threads, just choose a scheduler   * **Reactive programming** using **[[https://​blog.gojekengineering.com/​multi-threading-like-a-boss-in-android-with-rxjava-2-b8b7cf6eb5e2|RxJava]]** or **RxKotlin** - do not need to explicitly create threads, just choose a scheduler
Line 253: Line 253:
 ===Task 2 (4p)=== ===Task 2 (4p)===
  
-Mock the download of several files (at least 10) in parallel on multiple threads using Runnables and ThreadPoolExecutor ([[https://​developer.android.com/​reference/​java/​util/​concurrent/​ThreadPoolExecutor|documentation]],​ [[https://developer.android.com/training/multiple-threads/​create-threadpool#​ThreadPool|creation ​example]]).+Mock the download of several files (at least 10) in parallel on multiple threads using Runnables and ThreadPoolExecutor ([[https://​developer.android.com/​reference/​java/​util/​concurrent/​ThreadPoolExecutor|documentation]],​ [[https://www.journaldev.com/1069/threadpoolexecutor-java-thread-pool-example-executorservice|example]]).
   * For the "​mock"​ download, each thread should sleep a random number between 100 and 200 ms.   * For the "​mock"​ download, each thread should sleep a random number between 100 and 200 ms.
   * The UI should update in real time a text view with the following content:   * The UI should update in real time a text view with the following content:
Line 262: Line 262:
       …       …
       </​code>​       </​code>​
-   ​* ​The text view must have the option ​android:​inputType="​textMultiLine".+   ​* ​To show multiple line you can add the ''​android:​inputType="​text"''​ to the TextView
  
  
smd/laboratoare/04.1617872912.txt.gz · Last modified: 2021/04/08 12:08 by alexandru.chirvase
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0