Mapbox GL Android SDK : Keep this in mind to avoid memory leaks

If you are using mapbox android SDK you are very likely to end up having a HUGE memory leak if you are not taking the special precaution.

Please remember to call all lifecycle methods on your mapview. And perticularly onDestroy()

If you forgot to call onDestroy() on your mapview it will result into a HUGE memory leak which you can even validate and check using your android studio profiler.

A memory leak will be huge to an extent that it will throw up your app memory usage to 1.5 GB on your smartphone for an app which usually do not consume more than 100 MB.

So take care of that you are calling onDestroy() on your mapviews and all other lifecycle methods and you will be fine.


For more info see this link : and see the overview section



Best Libraries for android Development

Standard Essential Libraries

These are some of the De-Facto standard libraries which are Essential for development in any Android app Project.

Rx-Java and Rx-Android

Link [Rx-Java] :
Link [Rx-Android] :

Rx: Which Stands for Reactive Programming is one of the most popular upcoming trends in the development. Reactive Programming is every where. We have reactive programming in JavaScript also and many languages are adapting to support reactive programming. Rx-Java was born out of the development efforts in Netflix. As an attempt to scale their Video distribution Service Netflix engineers created Rx-Java as a solution to solve some of their Issues and Problems with scaling. Rx-Java solves your asynchronous programming needs. You can replace your Asynctasks with simple and easy to understand Rx-Java code.

Picasso, Glide [ Image Loaders ]

Link :
Link [Glide] :

Picasso and Glide are one of the best and the most Essential Image Loading Libraries for the Android.




Link :

One of the quintessential library for android Development. It helps you remove the boiler plate for Binding Views using annotations like @BindView instead of using .findViewByID() functions. It also help you to bind click Listeners for your UI components.

Dagger 2 for Dependency Injection

Link :

Dagger 1 was started as a project at Square Inc. Google own internal team of Developers joined in the development Efforts to give rise to revised version named Dagger 2.

Dagger 2 uses annotations instead of Reflection for injecting Dependencies. This helps in improving Performance and Provide many other benefits. Dagger 2 is Termed as one of the fastest and most efficient Dependency Injection Library for Java at present. Dagger 2 is an Annotation based dependency Injector, which is notably popular because of its ability to generate errors and validate errors in Compile time. Unlike Guide Dagger 2 would let you know your possible Errors in Compile Time instead of Run time. It wars you of your erros in advance so that your application dont end up failing up at run time.

Stetho  – for analyzing Sqlite Database Schematic for Content Providers

Other Useful LIbraries

MP-Chart Android Library :sunny: for Drawing Graphs, Bar Chart, Pie Charts, Line Charts

Best Tutorials and Links

This is a Live Wiki Article which will be updated regularly and new information will be added whenever needed. Anyone can edit this article. Feel free to add any relevant information to this post.


Tutorials For Java Development

Tutorials for Android Development

Useful resources for android Development


Tutorials For Java Development

Java Brains [ For Java Development]

Link to Youtube Channel :

Link to Website :

Java Brains is a youtube channel which teaches you Enterprise Java Development.

Java Brains is not a tutorial for Android. It is a tutorial for Java Development. If you are looking for Tutorials of developing the Java Back-end this tutorial will help. Very good and best rated tutorials. Easy to understand and freely available.

Tutorials by Jackob Jenkov [ For Java Development ]

Link :

Easy to understand / comprehend. No frills tutorials for learning Java which provides good and deep understanding of Java and also some more help about learning Enterprise Java.

Tutorials for Android Development

CodePath Android Guides [ Cliff Notes]

[One of the best tutorials for learning profession / Expert Android Development available on the Web. ]

Link :

For beginners and Experienced Developers both. This tutorial is something which beginners can easily comprehend and even experienced android developers will find this tutorial useful.

From my personal experience, these tutorials are one of the best guidance Available for Learning professional Android Development.

Android Hive

Link :

Very good tutorials for android beginners. In depth and clear and simple and easy to understand tutorials for learning Android.

Grokking Android Blog

Link :

Contains very good tutorials on content providers, sync providers and android in General.

Styling Android Blog                                                                                                                  

Link :   

Contains very good tutorials on Constraint Layouts



Useful resources for android Development

Material Palatte


If you are having trouble choosing Colors for your Material Theme. This is the site you need to checkout !

Material Icons

Link :

Free to use. Official Icons for Android Development licensed under Creative Commons / Public Domain. You can download this icon in PNG format or SVG vector image format.

Googles Official Design Site

Link :

Googles official design website

Official Android Developers Blog

Link :

Official Blog for android Development. keep yourself updated with latest official updates in the android development.

Android Arsenal : Directory of Android Libraries

Link :

This site, is a directory of android libraries published across the web. You can find lot of new and interesting android libraries here. You can explore trending libraries at this site. If you have any special needs there might be a library for your need. Check out this directory !!

Material Up : Web Magazine on Material Design

Link 1 :  | Link 2 :

Check out New and upcoming design trends in android development. Particularly trends in Material Design.

Diversity in Android Ecosystem

Unlike apple the android ecosystem is highly diverse. Its good and have many benefits but that could also be a real pain in the ass and require some extra work.

Being diverse mean that there could be hundreds of different types of android device and you need to ensure that your app looks good and functions appropriately on all of these devices.

So, let us see what are some of the officially recommended solutions and ways to address this issue and these solutions are also the best practice strategies for addressing the diversity in android ecosystem.

In android we have the concept of buckets

  1. The screen size buckets
  2. The screen density buckets
  3. The android version buckets
  4. The portrait and Landscape buckets

If you are confused right now and do not understand what does bucket really mean and how it works do not worry we will study them in the following paragraphs.

Screen Size buckets

An android device can have Different screen size. So in order to ensure that your app UI looks good on all screen sizes you need to design a responsive layouts. A responsive layout is a layout that adapts itself to suit on different screen sizes such that it looks good and remain functional on all the screen sizes.

In order to address this issue android project provides a concept of screen size buckets.

You can provide extra layouts for different screen sizes and you can put each of these layouts in their respective screen size buckets.

When your app is getting executed / running on a device. The android run-time will pick the appropriate layout from the appropriate screen size bucket if the extra layout is provided and made available by the developer. If no extra layout is provided in the appropriate bucket. The default layout will be used.

Consider you want to design a screen which looks good on phones and tablets both. In order to make the layout responsive you supply an extra layout for tablet screen. When executing your app on the tablet the android run-time will look for the appropriate screen size bucket according to the screen size of the running device which in current case is the tablet. If the extra layout is provided for the given tablet screen size then that extra layout will be used. If the extra layout is not provided the default will be used instead.

Nesting the Buckets

Recyclerview Hazards


There are some cases where you may end up using recyclerview in inappropriate ways that could backfire. The recyclerview may throw exceptions which
may have causes difficult to understand.

Let us take a look at some of these cases. These cases are from actual real world experiences.

Case 1:

Whenever you call dataset.clear() please call adapter.notifyDatasetChanged() immediately.

When you call dataset.clear() the recyclerview remains in an invalid state until you call notifyDatasetChanged(). Using the recyclerview in the invalid state will throw nasty exceptions which might be difficult to understand.

So just remember that whenever you call dataset.clear() you must immediately call adapter.notifyDatasetChanged() on it. Before the recyclerview is used.

Lessons to learn : *

Whenever your dataset changes you should call adapter.notifydatasetChanged() as soon as possible. Before you start to use it.

PS: Please note that this article will be updated as soon as we find more of similar cases.

Image Credits :

Cover Image Source :

Simple Guide to begin your career in Software

Published By Sumeet Moray,

If you are newbie who is just entering into a new developer career. Or you are a experienced developer having few years of experience. You may find this article useful. You can use it as a checklist to improve your existing career or a guide to begin your career for a new developer.

Your Github profile

Github profile is something you should have even if you are not looking for a job. Github is a community of developers where you can share your code with others. Github hosts one of the best and most popular software projects like angular js, bootstrap, retrofit (android library), butterknife (android library), Picasso (Image loading library for android). Joining Github give you a sense of being a part of developer community and this will provide a great source of inspiration and motivation for learning software development.

So make a github profile, start contributing to the projects and even start your own projects.

A mature github profile which shows some genuine work and contribution can help you a lot in your developer career and even help you get a job. These days employers have started looking at your github profile and they consider it a primary source of judging you and evaluating you. So if you want to become a software developer you cant imagine not having a github profile.

Start your Blog or website

If you are a developer and you love your job its is very likely that your mind is filled with new ideas and useful tips tricks that you wish to share with other developers. Most likely you already have a blog. Or if not then why are you waiting ? As a developer its always good to maintain a blog where you share your thoughts and ideas, this blog will help you socialise with the developer community. In future this blog will also serve as your identity where organisations and people can meet you, find you and get to know you through your blog.

Most likely you already have a blog if not then please create a new blog. In order to create a new blog make sure to get a good domain name. So Register your own domain. and host your own website. It will give a more better impression. Creating a new blog is easy. One of the easiest way to setup your blog is using WordPress or Ghost blogging software. Dont use Go-daddy hosting, it is for non developer community. Being a developer try using Digital Ocean. Digital Ocean is for developers it will give you some professional experience also.

Install Linux or Ubuntu and setup your development Environment

Most the developers can survive being a developer without learning linux. But it will truly benefit if you take some pain and try to setup your development environment on linux. Setting up development on linux is more painful but worth the pain and efforts.

Make your android app more User Friendly : A Checklist

Let us discuss here few things that you as a developer is likely to ignore or forget before releasing your app to production. It is very essential that you do not forget these issues as it will help your users to get the maximum benefit from the app that you are developing.

1. Use Content Descriptions (on the buttons)

Content Descriptions are used to provide non-visual clues for Blind users. Android framework offers a special service named talkback which guides blind users and enable them to use and benefit from your application. It does it by reading out loud the instructions for using the application. Talkback use content descriptions to guide the blind users how to use your application. Content descriptions provide you a way by which you can enable the blind people to use your app and benefit from it. Its always a good practice to take this into account when you are developing your application.

As far as the guidance i have received until now i am advised to use content descriptions at the buttons. So You should use content descriptions at all the buttons in your application.

2. Enable RTL layouts and test your app for RTL orientations

Unlike conventional scripts which follow left to right reading pattern. Arabic scripts follow right to left reading pattern.
Enable RTL layouts and testing your app for RTL layouts ensure that your arabic user community like your app.

For Enabling RTL Layouts follow these instructions: 

1. Add android:supportsRtl="true" in the application element in your manifest file. 

2. Remember to use "start" and "end" instead of "Left" or "right". Versions prior to android 4.2 doesn't recognise "start" and "end" so if your app supports versions older than 4.2 you need to use left and right also. 

3. Test your apps RTL layouts by enable RTL layouts from the developer options. 

For more information refer to this link.
Links :

3. Prefer / allow Installation at External Storage

Android is highly popular in the developing countries where most the the users have low cost devices. These low cost devices (Tablets / Phones) come with low internal storage. Running out of your internal storage memory is a very common issue that people face there. This problem is not just limited to users of developing countries. This problem can be faced by any user if your phone is old and you didn’t bothered to buy a new phone.

When you run out of your internal storage. You cannot install new applications on your phone. In this situation it would be really helpful to the user of this phone if you allow your app to be transferred to internal storage.

By default android doesnt allow the apps to be transferred to internal storage. Unless the developer has explicitly enabled the app to allow the installation of the app on external storage.

You should not forget to enable this option. This will really help the users get the most out of your app. Happy users are long terms users. Making your users happy goes a long way in bringing success for your efforts. So you must focus on user happiness, and their usability.

To allow installation on External Storage follow these Instructions. 

You need to Add  
to your Manifest element in your app manifest. 

For more information refer this article
Link :

Useful Inspections in Android Studio – Part 1

A code inspection is a way by which your IDE (Android Studio) can analyse your entire project code for some specific issues and suggest you the appropriate improvements.

There are many inspections which can help save lot of your development time. Here we discuss few of them.

I will update this article to include more inspections as i find new inspections. Right now i list out the ones i found useful.

1. Hard-coded Strings Inspection

In the android development it is considered a good practice to move all of your strings in the Strings.xml resource file. This helps you to reuse your strings and save your time in typing repeat messages at the various places.

It is very trivial that you may forget to transfer your strings to the strings.xml file. In this situation you might be worried/concerned about how to find all the hard-coded strings in your project and transfer them to the strings.xml file. Let us see the instructions !!!

Go to Android Studio and navigate to

Analyze > Run inspection by name 
and Type "Hardcoded strings".

This inspection helps the users discover all the hardcoded strings in your project and you can now move those hardcoded strings to the Strings.xml file.

Passing objects from one activity to another activity

While developing on android platform we often face requirements where we have to pass objects from one activity to another. The officially recommended way of passing objects is to make your object implement Parcelable interface.

In this article we will learn that you dont have to implement Parcelable interface to pass objects from one activity to another activity and this approach has certain pitfalls. The non-primitive variables will not get parceled unless they implement parcelable Interface. Timestamp’s do not get parceled. There are fixes for parceling timestamp and non-primitive objects but they get messy, complicated and also buggy.

Implementing Parcelable also makes your code looks ugly and it will bother you if you want to see elegant and simple to understand code.

An alternative to implementing Parcelable interface is to encode objects into JSON String using GSON Converter and then pass the string with the intent to the another activity. On the receiver end you decode the JSON string into an actual Object.

If you are a beginner then you may not understand what i am saying here. You should refer and learn the concept of JSON parsing and GSON converter. After you have learned these concepts you will be able to understand this topic.

Let us try to see that in action how we use GSON Converter to pass objects from one activity to another.

Case One : Passing a Single Object

In this example i am passing a custom object named “ItemImage” you can replace ItemImage with any other object of your choice.

Step 1 : Encode the Object into a JSON String

ItemImage itemImage = new ItemImage

Gson gson = new Gson();
String jsonString = gson.toJson(itemImage);

Intent intent = new Intent(this,ReceiverActivity.class)

In this example we see how we have encoded our custom object into a String using GSON converter. You can passing this string from one activity to another using regular intents.


Step 2 : Decode the Object from a JSON String

String itemJson = getActivity().getIntent().getStringExtra(ITEM_IMAGES_INTENT_KEY);

Gson gson = new Gson();
ItemImage itemImage = gson.fromJson(itemJson, ItemImage.class);

On the receiving end we will receive our encoded JSON String. We can decode this JSON String back to our object using the GSON converter.

Case Two : Passing a List of Objects

In the above example we saw how we can pass a single object. But the procedure for passing a list of objects is somewhat different. Therefore we will discuss here how we can pass a list of objects from one activity to another.

In this example i am passing a list of ItemImage objects . You can replace ItemImage with any other object of your choice.

Step 1: Encode the List into a JSON String

List list = new ArrayList<>();

Gson gson = new Gson();
String jsonString = gson.toJson(list);

Intent intent = new Intent(this,ReceiverActivity.class)

We have encoded the list into a JSON String. We can now pass this string from one activity to another activity using regular intents.

Note : If you are a beginner and dont know how to pass a string from one activity to another activity please go through an introductory tutorial on how to pass a string using an intent. You can find that tutorial using a google search.

Step 2 : Decode the List from the JSON String

String itemJson = getActivity().getIntent().getStringExtra(ITEM_IMAGES_INTENT_KEY);

Type listType = new TypeToken(){}.getType();
Gson gson = new Gson();
dataset = gson.fromJson(itemJson, listType);

We have received JSON string in the another object. Now we have to decode the JSON string


Advantages of using GSON converter over Implementing Parcelable Interface

  1. You dont have to implement another interface for your existing objects. GSON converter will just convert any object into a string and a string back to Objects.
  2. Timestamps get transferred easily without any issues.
  3. The non-primitive instance variables gets transferred easily without implementing any new interface


PS : Please note that instead of using a GSON converter you may use any other converter of your choice.

Best practices for android development

I have about two years of experience as an android developer and I have published nearly 3 apps on playstore. In this article i will share you some of the best practices that i learned on my journey as an android developer.

I have been through lot painful experiences and made lot of mistakes and i have learned from my mistakes. I hope sharing my experience will help you save your time and energy.

Coding Suggestions

keep android studio updated

Android studio was not fully developed and it had lot of bugs. With each new version of android studio engineers at google are improving the IDE and fixing bugs and increasing performance. In my own experience as an android developer lot of times new version get fixes to one of the most annoying issues. Keeping android studio updated to a stable version can really save you a lot of your time.

Android Studio until now had a lot of issues and bug fixes. Official documentation for android studio tells that android studio version 2.3 is one of the best quality IDE till date. Which is released only recently.

Keep your gradle plugin and gradle updated

Gradle build system was very slow and one of the biggest bottleneck in the speed of android studio and building the software. Each new version of gradle and gradle plugin are offering improvments in performance and build time. Recently lot of improvements have been made and these days gradle has improved a lot. It has become more faster. Keep your gradle plugin and gradle version updated.

Always use a support library

Initially enginners at google planned to provide support library as something which is optional. But later as android platform grow google started pushing one of the best and most essential features exclusively to the support library. Which implies that google recommends using support library. It no longer considers support library as optional.

Officially google may not tell you but on an informal level everybody knows that you must be using the support library and its not optional but something which is mandatory part of android development.

Consider alternatives to Parcelling Objects

While developing on android we often face requirements where we have to pass objects from one activity to another. The officially recommended way of passing objects is to make your object implement parcelable interface.

You dont have to implement parcelable interface to pass objects from one activity to another and this approach has certain pitfalls. The non-primitive variables will not get parcelled unless they implement parcelable Interface. Timestamp’s do not get parcelled. There are fixes for parcelling timestamp and non-primitive objects but they get messy and complicated. An alternative to implement parcel interface is to encode objects into JSON String using GSON Converter and then pass the string with the intent to the another activity. On the receiver end you decode the JSON string into an actual Object. You may not understand this if you are not aware of JSON parcing and convertors. Dont worry in this situation. Try to learn about JSON Parsing first and then revisit this topic. This will help you gain a better understanding.

Always consider using a fragment even if you are using only a single fragment within an activity

Even if you have only one fragment in your activity you can still benefit from using a fragment. There are many benefits of using a fragment. Fragments make your code more reusable. It simplifies the development. Fragments even simplify and help you in dealing saving instance state while configuration change. You can use set retain instance option in fragment which can help you retain your instance variables.  You can find out more about how fragments can retain instance variables at this link :

One of the reason why most of the developers refrain from using fragments is because they get confused about how to use fragments. But when you gain a better understanding on how to use fragments you will start to appreciate better why using a fragments is a best practice and it is a standard.


Tips and Tricks

Consider using a real device compared to an emulator

If you are profession android developer and working an a real world project it is always good to use a real android device for launching and testing your apps while developing instead of using an emulator. When you are developing on an emulator you miss out of lot of problems and issues which you may face later when you launch your app on a real device this happened with me when i developed an app using an emulator when i later discovered that there were lot of errors and bugs when i launched my app on a real device.

Emulator doesnt show you what exactly your app will behave on a real environment.

Use ADB over wifi

One of the biggest problems that android developers face while developing on a real android device is the need of connecting the device using a USB cable. The USB cable gets damaged usually after few months and then our connection to the device keeps failing.

One of the best alternatives to using an USB cable to connect your android device is to connect your device to your computer using a wi-fi connection. You no longer have to use USB cable and

Saving Instance State – Enable set retain instance which will help you in retaining instance state over a configuration change

Android developers face one very messy and ugly problem which is to save your instance state in order to recover from a configuration change. This problem can be simplified elegantly when you are using a fragment.

While using fragment enable set retain instance. This tells android not to destroy your fragment when configuration change happens and it therefore retains all the state of instance variables. More details about this is given at this link :

Prefer using contraint layout’s over Relative Layouts and Linear Layouts

Constraint layouts are a major improment over the previous layouts. It really simplifies the task of developing layouts. Its more powerful and also provide you a performance advantage. Therefore learn to use constraint layouts  and prefer to use it over other layouts.

use progress bars where ever possible

Typically when you make a non-blocking call like a network call. The user must know that some task has been performed in the background. The more progress bars you use the better use experience your app provide

Non-Coding Suggestions

Make a blog and share your experience

Making a blog will help you more than it will help other people. On your journey of becoming an android developer you will learn lot of useful experience and tips and tricks. If you dont take notes of the useful things which you are learning most likely you will forget them later. Therefore maintaining a blog helps you take notes of what you are learning as a developer. In the future when you forget something you can refer to your blog which may help you remind the solution.

Your blog will help you take notes of what you are learning. Your blog will become your notebook for you which will help you to come back to revise what you have learned.

These days you can start your own wordpress blog in a dedicated hosting platform on just 5 $ per month. So making a blog is not a big deal.

Consider developing on a Linux or preferably on Ubuntu machine

These days cloud hosting skills and open source is gaining lot of demand in the software industry. Developers with cloud hosting skills will have high demand in the near future in the software industry. Most of the popular cloud hosting platforms like digital ocean and AWS use linux servers and therefore having good expertise on working on linux will give you an edge when you are working on cloud hosting platform.

Do not forget to install 64-bit packages if you are developing on Ubuntu

This is a very common situation that most of the developers face when you are beginning to start android development on Ubuntu. You have installed Ubuntu 64-bit but you dont have 64-bit packages installed which are required for running some of the android SDK components. As a result your android studio build will fail. The most frustruating thing about this issue is that nobody will tell you the reason and cause behind the problem you are facing. After doing a lot of careful good search you will realize the true reason behind the problem that you are facing.

In order to install 64-bit library packages please go on to this link  and choose linux. Here you will find instructions on how to install 64-bit libraries.

Consider using at least 16 GB ram on your development machine

I know most of you would say that even 8 GB should be sufficient. But as most us android developers i must tell you that we don’t use our computer just for running android-studio. We tend to multi task and you are very likely to search for a solution on the internet while coding and therefore eventually you may have 10-20 browser tabs open. This is when you start to feel that 8 GB ram is not sufficient for your needs as an android developer.

Consider Using an SSD over a conventional hard drive

Android studio and Gradle build system require a computer with a good performance. There is a huge performance difference between an SSD or a conventional hard drive. Once you have used an SSD you will never switch to a regular hard drive.

Good Internet Connection is required its not Optional

When i started my career as an android developer I used to work over a low speed internet connection. Gradle and android studio needs good internet Connection. Gradle and android studio will be downloading lot of updates from the internet and sometimes it will do it in the background. If you have a low-speed internet connection then you are going to feel very frustrated as a developer because in most of the cases gradle does not even tell you that it is waiting in order to download a file over the intenet.

Join a developer forum or a developer community

Join a Software Development forum where you can interact with professional android app developers and keep in touch with other developers