RecyclerView “swipe to delete”. No 3rd party lib necessary.

Author is a professional software developer providing android and iOS development services. More info here.

Checkout the code at the github repo.

Big shout-out to the guys creating libs for all the stuff Google promotes but doesn’t give us code for just yet, but the fact of the matter is I prefer not to use those libs unless I absolutely have to. The lib you include in your project might be doing a lot more than you need it for and with that comes a burden on your precious method limit count, possibly longer builds, another lib you and your coworkers need to keep in your heads…

The other day I had to implement “swipe to delete” feature. I wasn’t very happy about that since I feel that it’s not very discoverable and that those kind of gesture based actions shouldn’t be the only way to access the feature, but that’s another story. Still remembering how difficult this was couple of years back on a ListView I’ve started googling and soon enough there was a simple SO post with a simple solution and the best part – no 3rd party lib needed! However, it wasn’t to be so easy in the end.

Continue reading RecyclerView “swipe to delete”. No 3rd party lib necessary.

Yet another post on Serializable vs Parcelable

Author is a professional software developer providing android and iOS development services. More info here.

All my android developing life I’ve used java serialization as a data transfer mechanism between activities. I was vaguely aware of Parcelable and it proclaimed benefits but never really saw any performance issues related to this and thus never had a need to start writing all the parcelable boilerplate in my classes instead of just marking them as Serializable. When I recently started working on an ongoing project I’ve quickly jumped ship since: a) it’s supposed to be an order of magnitude faster and b) there is an awesome code generation library, Parceler, relieving developers of writing the boilerplate while keeping all the performance goodness.

I’ve just finished implementing my first big feature in the app and all was well until our amazing QA guy came to me with an issue – app was crashing on transition from one activity to another – throwing a TransactionTooLargeException (or just logging E: !!! FAILED BINDER TRANSACTION !!! on pre 15 API levels). And he wasn’t even trying to do anything crazy. Quick google search led me to a world of remote procedure calls and binder transaction buffers, a world I was blissfully unaware previously. So there is this binder transaction buffer, and it appears to be limited to 1MB, and it is used by all ongoing transactions simultaneously. I am moving a fairly large object graph through an activity starting intent, and maybe I’m not supposed to be doing that, but surely I can’t be hitting a 1MB limit? Or can I?

Continue reading Yet another post on Serializable vs Parcelable

Converting an android app to a library

Author is a professional software developer providing android and iOS development services. More info here.

Are you trying to convert your android app to library? It’s very simple, just go, Properties->Android,  thick Is Library and that’s it. At least in theory, but here are couple of advices to make it work in real life as well…

Continue reading Converting an android app to a library

Android build target – a controversy

Author is a professional software developer providing android and iOS development services. More info here.

Here is a very good example why are android devs pissed off most of the time (you can find another in this post). Lets find an answer to this simple question: “What version of android should you build your project against?” I claim this should be set to maximum version your app is supporting (the latest existing one obviously)  and a colleague of mine, a respectable senior developer, claims it should be a minimum version your app is supporting. And we are both right because android resources say one thing here and another there.

Continue reading Android build target – a controversy

SVN, Android Pre Compiler and Mac OS X = PITA combination

Author is a professional software developer providing android and iOS development services. More info here.

As far as I’m concerned SVN is a thing of the past. In todays market of SCMs my weapon of choice is git and I’m very satisfied ever since I made that transition. That was easy enough for me, a freelance developer, but may not be so easy for a company for reasons both real and imaginary. That’s why I still have to use SVN for time to time whenever I’m consulting for a company with SVN repositories.

Continue reading SVN, Android Pre Compiler and Mac OS X = PITA combination

How to make Android Google Maps v2 work in android emulator

Author is a professional software developer providing android and iOS development services. More info here.

Couple of days ago I was in for a nasty surprise. Providing android training in a company here in Belgrade I wanted to present a demo app of location sensors and Google Maps API but when I sat to prepare it I realized that only yesterday new Google Maps API v2 for android has arrived :) Not a problem really since I love learning and keeping up to date with changes but not beeing able to run maps powerd app in an emulator was a really  unpleasent surprise. Read on to see how you can make this happen.

Continue reading How to make Android Google Maps v2 work in android emulator

5 android helper apps for development

Author is a professional software developer providing android and iOS development services. More info here.

Android development can be a frustrating endeavor. There is a number of obstacles and difficulties but a large community always finds a way around them at least. Here are 5 apps every developer should have on their work belt.

Continue reading 5 android helper apps for development