Transcript

Android Development War Stories

by Lope EmanoApril-June 2014

Seriously though.

The Format

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

Things I’ve learned the past few months

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

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

Libraries

Guava

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

No need for ActionBarSherlock

- Android support library can now suffice

Butterknife

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

@InjectView within ViewHolder❖ A Jake Wharton project

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

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 [ ]

EventBus

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

-Lope Emano

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

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

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

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

My hardest battle

❖ 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.

AsyncTask

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

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

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.

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

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)

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

Thanks!

top related