Is a RelativeLayout more expensive than a LinearLayout?

In a talk at Google I/O 2013 (Writing Custom Views for Android), Romain Guy clarified the misunderstanding that caused everyone to start using RelativeLayouts for everything. A RelativeLayout always has to do two measure passes. Overall it is negligible as long as your view hierarchy is simple. But if your hierarchy is complex, doing an … Read more

Most memory efficient way to resize bitmaps on android?

This answer is summarised from Loading large bitmaps Efficiently which explains how to use inSampleSize to load a down-scaled bitmap version. In particular Pre-scaling bitmaps explains the details of various methods, how to combine them, and which are the most memory efficient. There are three dominant ways to resize a bitmap on Android which have … Read more

Is there any performance reason to declare method parameters final in Java?

The final keyword does not appear in the class file for local variables and parameters, thus it cannot impact the runtime performance. It’s only use is to clarify the coders intent that the variable not be changed (which many consider dubious reason for its usage), and dealing with anonymous inner classes. There is a lot … Read more