Tuesday, 18 December 2012

Facebook For Android Goes Native, Ditches HTML5 Code

Leave a Comment
Facebook For Android Goes Native, Ditches HTML 5 Code

Facebook has just released an update to their mobile app for Android devices which you could download right now over at Google Play. Instead of the usual HTML5 version this new version uses native code which promises to be twice as fast when launching and opening your Timeline.

The release of Facebook for Android 2.0 comes just days after the company launched a campaign by placing posters in their work areas encouraging employees to dump their iPhones and instead switch to Android. This also comes 4 months after the August update for the IOS version also doubled its speed.

This new app has been in development over the year and several key issues were addressed to make improvements.

Reducing Garbage Collection

Inefficient handling of memory can often lead to lag or freezing of the app. The team was able to solve this by deferring performing allocation-heavy code until the user stopped scrolling. “Inefficient memory usage will result in many garbage collection events, which in turn can pause the application for multiple frames and cause visible stutter during scrolling.”

 Writing a Custom Event Bus

Event buses allow communication between different classes and the old one was pretty slow. This new custom event bus is lightweight and avoids all reflection and object iterators.

Moving Photos to the Native Heap

Loading photos can be one of the most memory intensive activities for a device. Previously this was loaded to the Java heap which often times resulted in out of memory errors. This time the team made photos load directly to the Native heap.

Writing a Custom ListView Recycler

The original ListView recycler was inefficient when it came to handling elements of varying row heights such as news feeds. The team had to create a custom view recycler to correct this.

If you have already updated your Facebook for Android app you won’t see any changes in the UI at all. What has been improved is all under the hood and will be immediately noticeable once you use the app.
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment