Top Banner
Android Development War Stories by Lope Emano April-June 2014
31
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Android development War Stories

Android Development War Stories

by Lope EmanoApril-June 2014

Page 2: Android development War Stories
Page 3: Android development War Stories
Page 4: Android development War Stories

Seriously though.

Page 5: Android development War Stories

The Format

Share and discuss experiences in an app you’ve built and/or the new things you’ve learned the past few months.

Page 6: Android development War Stories

Things I’ve learned the past few months

Page 7: Android development War Stories

New Design-First process is kewl

First two weeks:❖ Researched existing similar apps

(advantages and disadvantages)❖ Watched Android Design In Action videos❖ Sketched designs/layouts using pencil and

paper via printed out stencil kit

Page 8: Android development War Stories

New Design-First process is kewl

❖ Demo app to product owner in front of photoshop for insta changes

❖ Acquaint designer with terms like "actionbar, navigation bar, status bar, overflow" for easy communication

❖ Android asset studio❖ Look around for potential tools

Page 9: Android development War Stories

Libraries

Page 10: Android development War Stories

Guava

- Light and useful- Used only MultiMap and StringUtils- Still have a lot to learn!

Page 11: Android development War Stories

No need for ActionBarSherlock

- Android support library can now suffice

Page 12: Android development War Stories

Butterknife

❖ Very light weight❖ @InjectView, @Click, @OnItemClick,

@InjectView within ViewHolder❖ A Jake Wharton project

Page 13: Android development War Stories

Ormlite

❖ ORM for SQLite w/ android support❖ annotations for field -> property mapping❖ powerful Dao❖ learned about extending BaseDao❖ still figuring out how connections get

closed

Page 14: Android development War Stories

FTS/Full Text Search on SQLite

❖ Found out FTS is supported on SQLite❖ Not supported on ORMLite so used

SQLCursor❖ Limited to prefix search:

“a” will return [“apple”, “anderson”]“pple” will return [ ]

Page 15: Android development War Stories

EventBus

“Eventbus is one of the most badass things that has happened to me as an android developer”

-Lope Emano

Page 16: Android development War Stories
Page 17: Android development War Stories
Page 18: Android development War Stories

When I saw those two slides, I didn’t really realize what it implied.

Page 19: Android development War Stories

Why EventBus is a lifesaver

❖ No need to pass ids between activities via intent bundles

❖ Passing objects from activities to fragments is much easier

❖ Said my goodbye to parcelables❖ Communication from background thread to

main thread is easier

Page 20: Android development War Stories

Why EventBus can be dangerous

Prone to memory leaksEventBus stores a listmap of subscribers of

different types of events. If you forget to unregistered a registered object then eventbus will hold that object forever

Very AddictiveEventBus even when you don’t need it and thus

ending up with an app with so many events

Page 21: Android development War Stories

Check it out! http://www.slideshare.net/greenrobot/eventbus-for-android-15314813

Page 22: Android development War Stories

My hardest battle

Page 23: Android development War Stories

❖ I needed to upload some images to a server in a background thread.

❖ I needed to move around the app without the upload getting cancelled.

Page 24: Android development War Stories

AsyncTask

❖ Worked well but when I left the activity the I/O stream for reading the image would get closed.

Page 25: Android development War Stories

Volley❖ Popular due to I/O presentation❖ Found a hard time to find the source code

and jar files plus I found something more mature and well documented

❖ I think google is planning on integrating this with SDK

❖ Mirrors available

Page 26: Android development War Stories

RoboSpice❖ Launched a service to do long running

background processes❖ Was relatively easy to set up. ❖ There was a learning curve but it wasn't

that steep.

Page 27: Android development War Stories

RoboSpice got me to where I wanted but then I realized I wanted something more- an offline mode for the app.

Page 29: Android development War Stories

Android Priority Jobqueue (Job Manager)

❖ Path project written mostly by yigit❖ Supported Offline Mode❖ Supported Network State Listeners❖ Supported Job Priority❖ Supported Job Sequencing❖ Supported Dependency Injection (was

able to integrate it easily with dagger)

Page 30: Android development War Stories

Comprehensive sample available! https://github.com/path/android-priority-jobqueue/tree/master/examples/twitter

Page 31: Android development War Stories

Thanks!