Tuesday, 20 May 2014

Are You An Android App Developer? Here Are 10 Tips To Improve Performance!

Posted by krishna
Android is a rapidly evolving platform. The OS gives endless opportunities to developers to build some real amazing apps, provided they are up-to-date with everything that exists or comes up in the world of Android. If you're an Android developer, performance of your app is perhaps the most important thing that can make or break your app. Here are some tips for you!
Android App Developer, Performance, coding practices, AsyncTask, thread, IntentService, Android SDK, StrictMode, debugging, Hierarchy Viewer tool, layoutopt Tool




1.Good coding practices is the mantra

Remember that the usual stack of coding mantras apply to your Android applications as well. Therefore it's ideal you follow them. Stick to common sense, well-established algorithms and standard design patterns while developing.

2.Block operations off the main UI thread

Use AsyncTask, thread, IntentService, or custom background service to keep your appls nimble or simply use loaders to simplify managing long loading data, cursors for instance.

In case an operation takes time and resources it's ideal you offload the same and perform the process asynchronously to allow the app to remain responsive even as you go about doing other stuff.

3.Stay up-to-date with the latest Android SDK versions, APIs etc

It's important that developers remain up-to-date with the constantly evolving Android platform. During evolution, some features may be retired, or replaced with better options. Furthermore, APIs tend to receive bug fixes and performance updates from time to time. As such developers must remain on their toes with regards to the same.

4.Try StrictMode

StrictMode is most commonly used to catch accidental disk or network access on the application's main thread, where UI operations are received and animations take place. Keeping disk and network operations off the main thread makes for much smoother, more responsive applications. By keeping your application's main thread responsive, you also prevent ANR dialogs from being shown to users.

5.Disable/minimise debugging and diagnostics prior to release

Failure to do so will result in crucial performance hit.

6.Keeping your layouts as simple as possible

Simple screens allow easy reading while simple layouts load lightening quick. Instead you can focus on developing an elegant user interface. The practice will allow for greater performance and create an app that is far more efficient for users.

7.Keep your appl package file reasonably sized

Tailoring your application resources to your target devices will ensure they load as efficiently as possible with no hassle. More ideally you can include only the core resources needed to run the application initially. The application can then download additional content during later stages.

8.Using the Hierarchy Viewer tool

The tool lets you debug your application layouts while also providing profiling information about how long it takes each View control within a layout to measure, render, and draw.

9.Using the layoutopt Tool

This command-line tool lets you identify unnecessary nesting of controls and other ways to collapse your layout resources to make them as nimble as possible.

10.Using Traceview

The profiling tool lets you debug and find performance bottlenecks in your apps.

Source: Developer.com 

0 comments:

Post a Comment