Showing technical resources tagged with Best Practices:
Avoiding Memory Leaks
Mobile devices often have limited memory, and memory leaks can cause your application to waste this valuable resource without your knowledge. This article provides tips to help you avoid common causes of memory leaks on the Android platform.
Faster Screen Orientation Change
When an Android device changes its orientation, the default behavior is to automatically restart the current activity with a new configuration. However, this can become a bottleneck in applications that access a large amount of external data. This article discusses how to gracefully handle this situation without resorting to manually processing configuration changes.
Layout Tricks: Creating Efficient Layouts
Learn how to optimize application layouts as this article walks you through converting a LinearLayout into a RelativeLayout, and analyzes the resulting implications on performance.
Layout Tricks: Using ViewStubs
Learn about using ViewStubs inside an application's layout in order to inflate rarely used UI elements, without the performance implications which would otherwise be caused by using the <include>
tag.
Layout Tricks: Merging Layouts
Learn how to use the <merge>
tag in your XML layouts in order to avoid unnecessary levels of hierarchy within an application's view tree.
Multitasking the Android Way
This article describes best practices and user experience guidelines for multi-tasking on Android.
Painless Threading
This article discusses the threading model used by Android applications and how applications can ensure best UI performance by spawning worker threads to handle long-running operations, rather than handling them in the main thread. The article also explains the API that your application can use to interact with Android UI toolkit components running on the main thread and spawn managed worker threads.
Tracking Memory Allocations
This article discusses how to use the Allocation Tracker tool to observe memory allocations and avoid performance problems that would otherwise be caused by ignoring the effect of Dalvik's garbage collector.
Updating the UI from a Timer
Learn about how to use Handlers as a more efficient replacement for java.util.Timer on the Android platform.
Zipalign: an Easy Optimization
The Android SDK includes a tool called zipalign that optimizes the way an application is packaged. Running zipalign against your application enables Android to interact with it more efficiently at run time and thus has the potential to make it and the overall system run faster. This article provides a high-level overview of the zipalign tool and its use.
Multiple Resolutions
A sample application that shows how to use resource directory qualifiers to provide different resources for different screen configurations.
Hello Localization
The basics of localizing your applications for multiple languages and locales.