All CategoriesAndroid App Development

10 Android Mistakes in App development You Should Avoid

Introduction

Mobile apps play a vital role in the competitive business world today. While developing an Android app, it is important for a successful Android developer to pay attention to certain important things. In this blog, we will discuss some of the common mistakes in app development and how to avoid them.

(You can even treat this post on avoiding mistakes in app development as a crash course in app development good practices.)

Some of the common android mistakes in app development are:

⦁ Making static tabs that belong to the buttons.
⦁ System notification color in different colors
⦁ Splash screens are redundant beyond the initial setup/introduction. Do not use them in other scenarios.
⦁ The image path is too long, so it will raise a 9-patch image as below:

So, here we will discuss the top 10 android mistakes in app development.

Mistake #1. Not using Intents

An Intent is a simple message object that is used to communicate between Android components such as activities, content providers, broadcast receivers, and services. Intents are also used to transfer data between activities.
For example, if you are working on gallery app which should download link of some images via SMS, your code should look like below:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:" + telephoneNumber));
sendIntent.putExtra("sms_body", x);
startActivity(sendIntent);

Start an Intent and let an app designed for SMS do the work
Link: Android Intent

Mistake #2. Not using Fragments

The fragment is a small part of activity. It splits the activity into sub activity called fragment that fits into an activity. This feature was for the first time introduced in Android 3.0 HoneyComb (API level 11).
There is no need to add any permissions inside a manifest file to create the fragment in your application. It provides us a way to give a consistent UI that is optimized for a wide variety of Android devices, screen sizes etc. We can also reuse the same fragment in different activities.
Launching different activities for each app separately is not efficient and it will occupy more memory for an app. It allows you to perform actions about fragments. These can leave your app in an unknown state when receiving clicking events. We should use fragments in the apps.
Link: https://acadgild.com/blog/introduction-fragments-android/

Mistake #3. ANR – Blocking the Main Thread

The main thread is used for keeping the user interface responsive. A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. So the thread takes user’s actions and interactions in activity. It controls when the Android app will stop responding (ANR – Application Not Responding).

Mistake #4. Not using Libraries/Not building Gradle properly

Whenever you are working on networks, image uploading, JSON/XML parsing and any social media login, your app will become complex and inefficient if you don’t use libraries.
So, make sure you follow the key points below:
⦁ Use Libraries like Volley (Network Access), Picasso (Image loading/uploading), Gson(JSON Parsing)
⦁ Use Gradle building and implement Gradle dependencies when it is needed.
Link: https://acadgild.com/blog/best-free-resources-need-make-android-app-libraries-tools/

Mistake #5. Not understanding Bitmaps/Avoiding the usage of Bitmaps

When you are working with images, Bitmap class will help you in creating bitmap images. You can create Bitmap images in resources, files or in InputStream class.
Example: If you want to create Bitmap image, you can use BitmapFactory class for the same.

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.someImage);

Mistake #6. Not Setting minSdkversion, compileSdkversion and targetSdkVersion in build.gradle file.

If you want to control or want to know which app is compatible with which API or what the required API level is, then minSdkVersion, compileSdkVersion and targetSdkVersion come into the picture.
compileSdkVersion is used to compile the Gradle and the version of the Android SDK to be used. minSdkVersion is used for minimum API support for Android apps. Remember the Libraries that you use, for example, any of the Support Libraries or Google Play services may have their own minSdkVersion — your app’s minSdkVersion must be at least as high as your dependencies’ minSdkVersion. targetSdkVersion gives you targeted (maximum) API that supports your apps. It means that the lower versions of targetSdkVersion will also be compatible with your apps.

Mistake #7. Not optimizing bandwidth usage/ poor Memory Management

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. We will discuss some of the basic memory management issues that programmers face.
Remember these points to avoid memory leaks and for better memory management.
⦁ Do not keep long-lived references to a context-activity (a reference to an activity should have the same life cycle as the activity itself).
⦁ Try using the context-application instead of a context-activity.
⦁ Avoid non-static inner classes in an activity if you are not controlling their life cycle. Use a static inner class and make a weak reference to the activity inside.
⦁ A garbage collector is not an assurance against memory leaks which occur when there is either too little memory available or your memory is too fragmented to allocate a large object.
Link: https://acadgild.com/blog/android-devices-memory-management/

Mistake #8. Not developing your apps with different sizes / Your apps is not compatible with all devices (screens) / UI (User Interface) is not compatible with all sizes of devices

If you don’t consider all types of devices while developing Android apps, your app will not be usable or user-friendly, so it should be run on the basis of user-experience. If your UI (User Interface) is not compatible (responsive) for all devices, it is just a waste of time. So the apps layout should be responsive/flexible to adjust to any size.
Link: https://developer.android.com/training/articles/perf-anr.html

Mistake #9. Not having an idea about the user interaction with app/ not thinking whether the app is user-friendly or not (Because everyone may not use your app the same way you would use it)

You can use the material design for improving user interaction, usability, and efficiency. You should use Toolbar, Floating Action Buttons, RecyclerView, CardView, Pallete for better user interaction and user experience for different types of Android devices. People will continue to use your app only when there are no bugs and the app design is user-friendly.
Link: http://www.slideshare.net/acadgild/get-introduced-to-android-material-design

Mistake #10. Not keeping code as simple as possible/Not using runtime app permissions instead of Default Permissions (One time Permissions)

When you are writing code for any app, it should be easy to understand and readable to any other developer because you have to work with a team. You should specify the code with comments explaining your coding lines. You should keep in mind some points as below:
⦁ You should follow the naming conventions provided by Java coding standards because Java would be your basic language for Android apps development
⦁ Use full English descriptors that accurately describe the variable, field, class or interface.
⦁ Each and every function should be commented properly
⦁ Each block of code must be surrounded by try-catch block so that the application does not crash
⦁ There has to be separate packages for Activities, Constant Data and Class Data Objects for the application.
⦁ Progress dialog should be used wherever there is some heavy processing or network operation running
⦁ Use custom styles and themes to make the UI consistent throughout the application if the UI is customized as per the client requirements.

Conclusion

Android is a powerful platform to develop Android mobile apps, wearable apps, glass apps, games and much more. It will be a great idea to avoid some of the above-mentioned mistakes in app development and follow good coding practices always.

After all, the difference between a groundbreaking app and a soon-to-be-forgotten-app is how well you manage to avoid mistakes in app development, and how diligently you follow good coding practices.

Hope this blog helped you in knowing 10 mistakes in Android app development that an Android app developer should avoid. Keep visiting our site www.acadgild.com for more updates.

Suggested Reading

Android Content Provider Example

Android Programming

Tags

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Close
Close