Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Les AsyncTasks
Search
Souleymane Sidibe
February 15, 2014
Programming
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Les AsyncTasks
Souleymane Sidibe
February 15, 2014
More Decks by Souleymane Sidibe
See All by Souleymane Sidibe
Android new UI ToolKit: Jetpack Compose
soulesidibe
0
200
Code sharing with Kotlin multi-platform
soulesidibe
0
130
Android Development in 2019. #devFestDakar
soulesidibe
0
130
Android App Bundle
soulesidibe
0
110
Proguard: The open source optimizer for Java bytecode
soulesidibe
2
120
Kotlin why you should consider using it
soulesidibe
0
140
Lightning talk : La trousse du développeur android
soulesidibe
0
77
Other Decks in Programming
See All in Programming
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
200
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
120
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3k
Modernizing iOS Apps
seyfoyun
0
130
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
380
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
200
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
210
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
1.5k
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
290
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
160
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
120
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
230
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
510
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
570
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
HDC tutorial
michielstock
2
980
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
320
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Music & Morning Musume
bryan
48
7.5k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
650
Transcript
Les AsyncTasks
Plan L’AsyncTask Les limites Android c’est du java non? La
solution magique Bonus
Un passionné d’android #nexus #startup #ios #java #play! #scala #ps3
#pes #techno #android #devops #BARCA #photos #google #api twitter: @soulesidibe gplus: plus.google.com/+souleymanesidibe
L’AsyncTask
• Traitement en background et mise a jour du UI
• Pas besoin de toucher aux Threads! AsyncTask.java
Pourquoi? AsyncTask.java
Pourquoi? • Ne pas bloquer le UI Thread! AsyncTask.java
Demo
Les limites
mAsync.cancel(true);
None
YourAsyncTask1 task1 = new YourAsyncTask1(); task1.execute(params); YourAsyncTask2 task2 = new
YourAsyncTask2(); task2.execute(params); Question: Serial or parallel?
Android c’est du java non?
Le framework Executor Executor executor = Executors.newSingleThreadExecutor(); executor.execute(new MyRunnable());
Le framework Executor Executor executor = Executors.newSingleThreadExecutor(); executor.execute(new MyRunnable()); ExecutorService
execute = Executors.newSingleThreadExecutor(); Future<Integer> future = execute.submit(new MonCallable());
Le framework Executor Executor executor = Executors.newSingleThreadExecutor(); executor.execute(new MyRunnable()); ExecutorService
execute = Executors.newSingleThreadExecutor(); Future<Integer> future = execute.submit(new MonCallable()); ScheduledExecutorService execute = Executors. newSingleThreadScheduledExecutor(); execute.scheduleAtFixedRate(new MonRunnable(), 0, 1, TimeUnit.SECONDS);
La solution magique
Fragment Activity
Fragment Activity Thread in progress
Fragment Activity Thread Done
Fragment Activity Thread Done BUS POST MyEvent
EventB MyEvent Thread Done BUS POST MyEvent MyEvent EventA EventB
EventA Subscribe Subscribe Subscribe
Event Bus Otto (goo.gl/sWxXY) EventBus (goo.gl/nAEW6) rxJava (goo.gl/TeWxWr)
Otto • Square (goo.gl/VlqRcA) • guava-based event bus • Open
Source • easy to use
Otto
Demo
Bonus
YourAsyncTask1 task1 = new YourAsyncTask1(); task1.executeOnExecutor(executor, params); YourAsyncTask2 task2 =
new YourAsyncTask2(); task2.executeOnExecutor(executor, params); Astuce
Communication entre Composants • Activity - Fragment • Fragment -
Fragment Otto, c’est doux!
Communication entre Composants Activity Fragment A Fragment B BUS
Links • #doc AsyncTask (goo.gl/MRbjQD) • #post The dark side
of AsyncTask (goo. gl/mm8IVR) • #tuto Le Framework Executor(goo. gl/MCJLq4) • #talk Android Bad Practices : comment foirer son app(goo.gl/Ix8Jsn)
MERCI!