Profile cover photo
Profile photo
Xavi Rigau
Xavi's posts

Post is pinned.Post has attachment
I've just published my first blog post where I explain how to write a device peripheral for Android Things, feedback appreciated! #AndroidDev #AndroidThings

Post has attachment
Hey! Today I've published the second part of my previous blog post ( and it is about how to unit test an Android Things driver.

Hope you can find it useful!

Post has attachment
I've just published my first Android Things blog post where I explain how to write a device peripheral for Android Things, hope you like it and feedback appreciated! #AndroidDev #AndroidThings

Post has attachment
Hey! I've noticed in the android things contrib-drivers repo there's a few of these '.driver-metadata' files (one in each different driver). Does anyone know what they're for? (example: )


Post has attachment
After 3 years at +Novoda I finally wrote my first blog post! My top 3 #androidstudio  shortcuts #androiddev  

Post has shared content
Healing brush implementation in Renderscript

If you are an #Android  developer you might be interested in this new Renderscript demo available in AOSP:

It shows how to implement a healing brush (an image editing tool found in apps like Photoshop, Pixelmator, Affinity Photo, etc.) using Renderscript. The video below shows the demo application in action.

Post has shared content
A lot of perf tricks we use on Android are really workarounds for issues in Dalvik. ART (the runtime in Android 5+) has very different perf characteristics. I think the trick that's most likely to be affected is object pooling. Here's why:

Dalvik's allocator is surprisingly outdated. It is not designed for multicore systems. There's a single global lock for allocations and deallocations. This means that allocations are ridiculously expensive compared to ART, which has thread-local allocation. So avoiding allocations by object pooling can be a big win.

On ART, though, POJO allocations are super cheap. ART actually uses fixed-size object pools under the hood, and because they use C++ tricks that aren't available in Java (like inferring the pool from the address of the object), the cost is comparable to the cost of managing an object pool in Java. Based on code analysis, I expect allocations to be slightly slower and deallocations to be slightly faster than a good Java object pool implementation.

That's not the whole story, though. ART also has a significantly more sophisticated generational collection model. Objects with short lifetimes are incredibly cheap to collect. But because of the way ART does concurrent collection, arrays of references can be kind of expensive. The cost is roughly proportional to the amount of churn in the array, so an object pool that sees heavy use is actually more expensive than a set of short-lived allocations.

All of which means that on ART, pooling is not an automatic win. Instead, the rules for pooling become pretty much the same as any other runtime: pool objects that are either (a) expensive to create, or (b) expensive to destroy.

As I mention in APP season 2 episod 10, Paint and Paint-related objects satisfy both of those conditions. But most POJOs don't.

[BUG] If I click in the Discover option on the left drawer then it opens a new instance of the Discover Activity but it shouldn't

Post has shared content
We've wrote up a summary for all those that couldn't make it to the last Android Meetup in London. Some Novoda clients kindly let us show off a few concepts for consideration of how we will transition to Material Design. #materialdesign #design #androiddev

Post has shared content
Couldn't be more excited! I'll be speaking at +droidcon London  for the first time. Come and join this amazing lineup of speakers 
Wait while more posts are being loaded