Android : Doing things in Background
Who am I ?
Aman Alam
Co-Founder,
Happily Coded Mobile Solutions,
Assistant Organizer,...
What

Offloading UI Thread, doing heavy work in background thread

2
Why
- Network on Main Thread is not allowed
- Slow UI thread makes the ANR error show up
- Nobody likes slow apps
- A bit ...
Solutions
- Java Threads
- Handlers
- AsyncTask
- Service
- IntentService
- Getting Results back
4
What to use, and when
- Java Threads : Avoid
- Handlers : very small tasks
- AsyncTask : Simple tasks related to current a...
Getting our hands dirty

Code Time!

- Getting results back
- Java Threads
- Handlers
- AsyncTask
- Service
- IntentServic...
Further Reading
- Bound Services :
http://developer.android.com/guide/components/bound-services.html

- Keeping the app re...
Further Reading

- Background processing :
http://www.vogella.com/articles/AndroidBackgroundProcessing/article.html

- Cod...
That's All Folks!
Thank You!
Aman Alam

Contact:

Co-Founder,

aman@blrdroid.org

Happily Coded Mobile Solutions,

@amanal...
Upcoming SlideShare
Loading in …5
×

Android : Background Processing

1,117 views

Published on

A talk on how to do stuff in Background in Android, for IIT Kharagpur students.
Code used, can be found here on github: https://github.com/Sheikh-Aman/Teach/tree/master/BackgroundDemo

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,117
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
22
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Android : Background Processing

  1. 1. Android : Doing things in Background Who am I ? Aman Alam Co-Founder, Happily Coded Mobile Solutions, Assistant Organizer, BlrDroid Bangalore, IN Happilycoded.com @amanalam
  2. 2. What Offloading UI Thread, doing heavy work in background thread 2
  3. 3. Why - Network on Main Thread is not allowed - Slow UI thread makes the ANR error show up - Nobody likes slow apps - A bit about UI Thread 3
  4. 4. Solutions - Java Threads - Handlers - AsyncTask - Service - IntentService - Getting Results back 4
  5. 5. What to use, and when - Java Threads : Avoid - Handlers : very small tasks - AsyncTask : Simple tasks related to current activity only - Service : Somewhat heavy, independence needed - IntentService : Easy handling of multiple requests One shot to kill all doesn't work 5
  6. 6. Getting our hands dirty Code Time! - Getting results back - Java Threads - Handlers - AsyncTask - Service - IntentService 6
  7. 7. Further Reading - Bound Services : http://developer.android.com/guide/components/bound-services.html - Keeping the app responsive : http://developer.android.com/training/articles/perf-anr.html - Working with IntentServices : http://developer.android.com/training/run-background-service/create-service.html - Dealing with normal Thread : http://stackoverflow.com/a/6463591/243709 7
  8. 8. Further Reading - Background processing : http://www.vogella.com/articles/AndroidBackgroundProcessing/article.html - Code: https://github.com/Sheikh-Aman/Teach/tree/master/BackgroundDemo 8
  9. 9. That's All Folks! Thank You! Aman Alam Contact: Co-Founder, aman@blrdroid.org Happily Coded Mobile Solutions, @amanalam Bangalore, IN gplus.to/SheikhAman Happilycoded.com www.sheikhaman.com @amanalam

×