Android is a platform that successfully enjoys the largest audience. You get it free, it’s customizable and rapidly growing. And apart from your phone or tablet, it’s also available on your smartwatch, TV and car.
As the latest Marshmallow update is out there, Android programming is improving incessantly and since the initial AOSP release, the platform has matured a lot while the user expectations get high.
Out there you find myriad of different devices, with different screen sizes, chip architecture, hardware configurations and software versions. However, segmentation is often compromised here for openness, besides there are countless ways for your app to fail on various devices, even as an advanced Android programmer.
Despite of this segmentation, a number of bugs are introduced owing to logic errors. However, these bugs can be prevented easily when the basics are right.
Here we present the 6 most common mistakes made by Android developers:
Common Mistake #1: Developing for iOS
We often come across apps that are an iOS clone and that is just not the right strategy to go by in 2016. Pushing iOS design standards to your users is going to do you no good.
Find here the most prominent examples of this Android mistake:
- Don’t make static tabs and they do not belong on the bottom.
- There should be no color for system notifications icons.
- Don’t place apps inside a rounded rectangle.
- Splash screens are uncalled for beyond the initial setup/introduction. They must not be used in other scenarios.
- Lists must not have carets.
These are what ruins the user experience.
Common Mistake #2: Developing for Your Android Device
Each time it’s not possible that your Android app would look good on every device, thus take care of these aspects:
- Density-independent pixels (dp) are different than normal pixels (px).
- Resources are included various times in order to account for different densities and orientations.
- 9-patch drawables are stretched to fit the screen.
You will find numerous such scenarios, however after some you get able to develop a sense to cover them all with just a few cases.
Common Mistake #3: Not Using Intents
Among the key components of Android, Intent is a way to pass data between various parts of the app, or to say various apps on the system. Having Intents help you in many things like you can share content, take pictures, record video, pick contacts, add events, open links with native apps, etc. Intents must always be used in case of a custom implementation as it’s going to save you a lot of programming time stripping the AndroidManifest.xml of needless permissions.
Common Mistake #4: Not Using Fragments
It’s vital to use fragments properly as this is going to make your app more efficient. Fragments must be used whenever possible as fragments and cursor loaders have great purpose but they are poorly implemented.
Common Mistake #5: Blocking the Main Thread
The main thread is utterly useful in keeping the user interface responsive. However a lot of factors are responsible for measuring the frame rate perceived by our eyes/brain. If we go by the general rule then anything that’s below 24 fps with delay greater than 100 ms is not considered smooth.
This will lead to delayed feedback to the user’s actions while the Android app programmed by you is going to stop responding. When the user lost control over the app then this will lead to frustration and it’s common that frustrated users will surely give negative feedback. However, in case you block the main thread even for few seconds, then ANR is going to happen.
Abide by these Android programming tips to minimize this occurrence:
To avoid blocking the main thread, always use worker/background threads for: 1. network calls 2. bitmap loading 3. image processing 4. database querying 5. SD reading / writing
Common Mistake #6: Reinventing the Wheel
Most commonly what you do in your app is network calls, image loading, database access, JSON parsing and social login. This you do is every app actually. However, there is a better way to do the same, like here are the few examples:
- Use gradle as a build system.
- Use Retrofit / Volley for network calls.
- Use Picasso for image loading.
- Use Gson / Jackson for JSON parsing.
- Use common implementations for social login.
In case you require something implemented, then in most cases it is already written, tested and used widely. Just do some basic research and go through Android programming tutorials prior to writing your own code.
Android is a platform that’s quite robust and it evolved quickly. Even though you can’t expect the users to maintain the pace, yet it’s important for Android developers to do the same. So do ensure that you set the basics right before starting to expand.