Are you an Android developer? Are you looking for mistakes that most Android developers make so you can avoid them? There are a lot of mistakes made by Android developers and these mistakes often up end affecting the quality and performance of the apps they develop.
It is very crucial that you read this article till the end so you can equip yourself with the information on how to avoid these mistakes in your career.
Developing for IOS
You likely might not have detected this, it’s sort of reducing based on the taste of present android users, and now almost every android users have fell out of love with IOS and feel they shouldn’t be defining the market anymore.
However, one still gets to see fractions of their work in a new application being developed, sort of saying their application is being cloned by an android developer. Everyone going to the market to get an android device is making the decision by him/herself, and that decision is to be and must be respected.
If they need an IOS, they can easily get one and since they aren’t, why not just leave them to enjoy what they paid for.
It’s only advisable to adopt this method if and only if you have no choice as an android developer to do that. Some of the common copy and paste work done by most android developer during android development process includes:
- Making of tabs for application that seems to be a fraction of IOS, especially static tabs that is located at the bottom of the applications alone.
- Placing of application icon inside a round rectangle unless it’s the original logo for the application
- Special colour given to system notifications which shouldn’t be.
Developing for Android Device
Developing for android device means developing an application to work for just a specific product alone. This makes the application look like a system application instead of the common user application.
Unless one is planning to create an application for a specific product alone, most application won’t display well on all android phones, and this is a problem, since the beauty of an application is having thousands of people using it. Here are few points to note though android development:
- The (DP) Density-independent pixels are different compared to the normal pixel (px)
- Most resources used for developing application are repeated sometimes to get a clearer view, better density and orientation. This is not defined, it varies.
- But the best solution to this is getting different tools that can help you build applications that would work all rounds for any device whatsoever.
Not Using Intents
Intent is one of an android device key component. It deals with passing of data between different part of the application being developed, or different application on the device. You might have a messaging application on your phone; a good intent will involve connecting this application to others so as to be able to interact with them.
A good intent will save an android developer time and energy by reducing the quantity of codes to be written, but linking of applications to each other will reduce his stress. Linking your camera application to your social media application will help you post images taken easily.
Not Using Fragments
Fragments are known to represent behavior or just a portion of user interface in an activity. Combination of the fragments can be done for a single activity to build a multi-pane user interface.
Fragments are embedded into an activity and the lifecycle of these fragments is directly being affected by its host activity life cycle. But when an application requires launching different activities for it to work perfectly, this becomes inefficient and will have negative affect on the performance of the device.
So, when developing an application, reasonably attaching fragments or its processes as much as possible will help devices run faster, but if not done, devices that run the latest version of software developed by such android developer will end up getting spoilt before their expiring date.
Blocking Main Thread
Have you ever been working on your Android device and after a bit of the device hanging you saw a message that reads thus “Application not responding, do you want to close it?” If yes this is just the effect of blocking main thread probably during the android development by the Android developer. The main purpose of main thread is to keep the user interface responsive.
Although there are numerous ways of measuring the frame rate of an application to detect if there are little or big effects of blocking main thread on it activity, but a general criteria or rule says “Anything less than 24 frames per seconds will delay as higher or greater than 100ms and this won’t be considered as a smooth process.
This will continually result in delay in feedback or cause the application being programmed to stop responding. This problem was very common in the then Android2.X that some were so serious that users might be restricted from making calls on their devices.
There are ways to avoid blocking this main thread and this includes using worker/background thread for sub processes like:
- Network calls
- Image processing
- Database querying
- Bitmap loading
Reinventing the Wheel
So you bought a car, motorcycle or bicycle and it came with a circular wheel, reinventing the wheel deals with changing that shape to something else, well you know that is definitely a bad idea you may wonder why? Well not all roads will accommodate the new wheel you’re building.
So, in the same sense reinventing the wheel of an application poses more problem that solving them, developers are either building their own process or just editing what has been done before, either way they are changing something in the Android development process.
People have always argued that developing their own wheel is a very good choice and sees that as the best option for other developers. A user once said “Contrary to main beliefs, the main advantage of reinventing the wheel is that it gives you full control over the software”.
Android developer needs to note though that they are not the only one who will run such software, and that not all will understand a thousand jargons cooked together to give them that so call “UNIQUE” design. Others will keep struggling to use this software everywhere in the world and immediately they are faced with problem, the only feasible option is opting out of the software.
Avoiding reinventing the wheel is regarded as a standard bit of received wisdom in android development circle. Android devices have matured and developed over the years and scarcely is there a code somewhere that something similar has not been done before.
So, android developer, before picking your tools and start cooking codes, pause and just do a little research. Latest development in the Android development world includes:
- Using gradle as a build system.
- Using Retrofit / volley for network calls.
- Using picas for image loading.
Not Assuming Success
Let’s say an Android developer who has been cooking and frying different codes to achieve a certain design or to develop a certain code for a special course; he might get discouraged if there seems to be no clear solutions to the problem he’s encountering, that is where not assuming success comes in.
There might be so many reasons why most packages might not be sent, processed and received immediately they are needed. This problem might be based on round trip delay, network failure, lost packages amongst others.
In the real sense, successful network calls are more than those that are not successful, no one really don’t need to wait for server response to decide if he will or will not handle successful requests. It is best for android developer to assume success and just handle failure in the best way.
Although, now a days, everyone hates the idea of waiting. We all want things to be done immediately we start to think of them. But developers must be aware that a little patience with their work will only define success in their part, if not more unsuccessful processes will be recorded in 2018.
Not Understanding Bitmaps
A bitmap has been defined as being a type of memory organization or images file format that are used to store digital images. This term is widely used for Android development. As an Android device user we all love well-formatted contents that are looking fine. Who doesn’t love a beautiful picture, sculpture or design? Scarcely would we find one.
But, as beautiful as those images display on your devices, they have a portion of memory attached to your device that they are using, in fact they consume a lot of memory. So many calculations are done to just an image taken on your device via your camera. Let’s see a simple one; if you took a picture with your camera and you want to display this image on your screen the total memory needed for displaying that image is calculated as
memory_needed_in_bytess = 4*
Image_width * image_height;
You might wonder why we are including 4, simply put, the recommended bitmap configuration is ARGB_8888. The simple explanation is for every pixel drawn on the device we keep 8bit approximately one byte for the alpha, red, green and the blue channels in the memory for the image to be properly displayed.
This is a sort of not so complex calculation but if an Android developer doesn’t even know this, there will problems with the applications he will be developing. Alternatively the RGB_565 can be used as it requires less memory but loses more transparency.
Let say you’re taking a picture with your 12MP camera, the picture will be 4000*3000 pixels large and the total memory needed will be:
4 bytes * 4000 * 3000 = 48MB.
Isn’t that too large? Remember, this is just for a single image, what if you’re taking 10 of the same image; definitely the whole memory will be consumed. Here are few Android programming tips that you can follow to get the best result for your bitmaps display:
- Accurate measurement of the view you’re showing the image in must be done
- Learn how to scale or crop your large image to get something light
- Always show only what can be displayed.
Using Deep View Hierarchy
Layout in Android development has a XML presentation. Parsing of these XML presentations, need to be done to be able to draw contents over it. Their screen also needs to be measured, and all corresponding elements must be placed accordingly.
This process might be tiring and time-consuming but need to be done. If a layout has been inflated once, the system keeps using it over and over, but this inflation of layout must still occur at some points again to ward off errors in processing Relative layout or grid layout must replace the nested linear layout.
Not setting the minSdkVersion to 14
This is in fact won’t be seen as a mistake, but a bad practice by android developer during android development process. Users have moved on from the Android2.X that uses this method even though it was a ground breaking milestone then and incorporating this into latest designs gives more problem and add more complexity for those maintaining the codes.
To create a user friendly and more mature application you must set the minSdkVersion to 14. If these are not done here are two problems that this might cause:
- Users won’t be able to run their favourite application on the latest device since the software uses an old component and this will stop it from working on such devices.
- Users without resources to run such application will either new to downgrade their phone to run your software and this will become a problem for them and they will end up spending more money.
In this article, we have discussed as highlighted above 10 most common mistakes that Android Developer make in 2018. Knowing this ahead might help Android developers to easily solve or adopt ways to make Android development process more effective.