NEWS & BLOGS

Business, Industry, Technology & Management News, Trends, Tips & Blogs for a Successful Practice

Apogaeis-Technologies-Things-to-Consider-While-Developing-Android-Application

10 Things to Consider While Developing an Android Application

blog tags Technology
write your comment here Response

If you are running a software development firm or yourself a mobile app developer, then you must be aware of the challenges you face as a company or as an individual. Project management is not an easy task. You need high-level expertise and skill set to develop something, which can add real business value. Challenges are there, but what it takes to deliver the best are passion and attention.

Sometimes a small heedlessness can backfire. Many times we noticed that developers skip common practices. Unfortunately, these small practices turned out to be the dark shadows.

We all know Android applications are programmed using Java, which provides more power to the programmers and also set algorithms to make the app functional. Usually, developers do few common mistakes which result in an Application crash or ANR (Application Not Responding). But, if you follow few basic and general practices while developing your mobile application and test it thoroughly before releasing, you won’t face any difficulties.

In this blog, we are going to discuss few common mistakes developers do while developing an Android application and key factors we should consider while developing.

1. Skipping Exception Handling

Java’s one of the best features which allows developers to rectify if something went wrong with their code. Let’s check this example;

try{
// code which causes exception

}catch (Exception ex ){

// Printing the stack trace.

ex.printStackTrace();

}

Most of the developers simply prints the stack trace of the exception in the log which does not solve the problems. Developers should carefully analyse the possible cases and treat this piece of block as an opportunity to gracefully handle possible exception.

ALSO READ : “A Mobile App for a Smarter Business – How It can Increase your Productivity”

2. Converting datatype without proper checks

In most cases, while making API calls developers like to use String datatype for holding result which is not good. APIs results could be used in various modules for further data processing. To avoid unforeseen exceptions, a developer should try to convert and validate the results to before passing it on to the further modules.

Here is a simple example of getting results from API followed by data type conversion;

String result;

int age;

try{

result = callWebServiceForUserAge();

// This is an example, generally separate web service call does not happen to get the age.

}catch(Exception ex){

/*

* Not a smart way. Developer seems to too busy in chasing deadline to take care of graceful

* handling. Proper handling of exception needs to happen.

*/

ex.printStackTrace();

}

age = Integer.parseInt(result);

Now, let’s say user did not submit an age and database column is not having 0 as a default value. While you were sitting and enjoying a cup of coffee, all of a sudden you will get this Holy Grail sweet bug which caused java.lang.NumberFormatException.

3. Ruling on (Blocking) Main Thread

This is the worst case scenario when user gets annoying screen stating that

This not only makes a user annoyed but also indicates that user is not doing it in a right way.

Some programmers love ruling application with codes so they end up keeping their Main Thread always busy, which results in ANR (Application Not Responding).

Now, this may happen while reading large data from a device, while image processing or may be some other huge task that holds Main Thread for more than 5-10 seconds.

4. Unnecessary use of memory

It’s very important to reuse objects and sometimes even properties because all these require some memory when they are created and some amount of that can be saved by reusing them.

Let’s say you are loading a large set of data through API call and a beginner level programmer usually do something like

thisString data1 = JsonParser.parse(result, data1);

.

.

String data 15 = JsonParser.paser(result, data15);

And then,

textView1.setText(data1);

.

.

textView15.setText(data15);

Now, here programmer is creating 15 String objects which could have been prevented just by directly using parse method with data for each textview.

This is just one example but imagine when you are loading large files like images or audio files and not reusing objects which hold a lot of memory unnecessarily.

5. Use of corrupt file

Now this is not very common, but some of the developers working with media applications may encounter this problem. Now we can’t say it’s totally developers mistake, because sometimes in media applications users uploads corrupt files and that is not being checked at the server side. After accessing that you get native crash at /system/lib/libc.so.

This usually happens with image, audio, and video files but sometimes also happens due to Android developer’s mistake by not releasing the process.

6. Exceeding memory usage

Android applications are assigned a certain amount of memory and this varies on different ram sizes and their free spaces. If you exceed the limit then you will get outOfMemoryException and the worst case is sometimes its hard trace the buggy code.

7. Using deprecated codes

This is simply not at all good for business applications where you know that the project is going to be for a long term, so it’s very important to do code review after every new stable release of SDK.

Because if you won’t then some of the features will not be accessible to the users who are having new OS version.

8. Not handling network changes

It’s very common that most of the Mobile users change their network mostly due to data cost and fast access, so in this case it is very important that your application should handle network change else it will cause network failure for current session and you would not want to make user go through same boring login steps.

9. Front-end kicks

Unfortunately, it should not be very common for any application to cross the frame rate per second set by Android team, and also deep view hierarchy should always be prevented because it results in ANR after 5-10 secs as you would have already seen in main thread problem.

This means it is very important to use components (especially layouts) in a very smart way.

10. Supporting multi-Language (Not correctly)

Every developer or business owner wants their application to be accessed from every corner of the planet. It will increase the reach of your application as well as it will give you an option to be recognized as an international brand. But this also brings many problems if the application is not developed for multi-language support, which may result in application crash out.

A very common problem is asked by many users when their application crashes only for few specific languages. Let us tell you that all of the users may be knowing English so they tend to prefer their own local language and Android OS supports many more languages than you can imagine.

Our Take

There are many similar problems that need to be taken care by the developers and that’s what we do here at Apogaeis. We have a team of android experts dedicated for developing business applications and IT solutions. We are here to help you in addressing your technological requirements so that you can concentrate on your core business. Let’s collaborate to build game changing mobile apps which can transform your business. Contact Us with one of our android experts.

ALSO READ : “Mobile Application Development: Top 10 Factors to Consider”

Leave a Reply

Your email address will not be published.