Serializer is a tiny wrapper around the most popular JSON serializers for Java. Essentially it allows you to de/serialize a Java object into a JSON string using its supported serializers. You can even create your own serializer if you don’t want to use any of the default ones. By default, Serializer comes with Gson and Moshi as the underlining serialization engines. Gson is used by default with Serializer but can easily be overwritten to make use of either Moshi or any other serialization engine out there.
Debugging memory leaks in an android app can be a bit tricky. Recently we had to deal with this issue in one of our apps. This was caused due to a recent refactoring we did in our code base. We were holding on to an activity instance that needed to be Garbage Collected**(GC’d)** after the activity was destroyed. Yes, you would think the Android Runtime**(ART)** will GC this instance but no.
There are several contenders when it comes to persisting data on Android. At addhen, our favorite is cupboard. It’s a lightweight data storage for Android. At first, it seems like an ORM but it isn’t, as it doesn’t manage table relationships and all that fancy features that come with it. It gives you a neat API to store and retrieve data objects on Android. We structure our database tables around the JSON response we get from API calls.
At addhen, localization is something we take very seriously when developing an Android application. Though most of our apps aren’t translated into most languages, we make sure we build apps that are localizable. That way in the future when we’re ready to open the app to more regions and languages, we already have a strong foundation. I’m going to share some of our best practices for localization support. If you’re not familiar with what internationalization and localization are, I’ll go ahead to define them.
As you know SharedPreferences allows you to store key-value pairs of primitive data types in an XML and provides you with a decent API for storing/retrieving their values. It’s mostly used to persist values from Preferences/Settings screens. In a recent project, we wanted to make use of the Shared Preferences framework to store an object’s properties more so for convenience. Usually, we’ll store these in an SQLite database but with this use case, we thought it was overkill to do that.
First of all, thank you for dropping by our blog. This is our first blog post as a company specializing in Android app development. We will mostly be blogging about the projects we’re working on and the overall well-being of the company. Most content here will quite be technical as we will be sharing our experiences as we work on projects. Also, we will be writing a lot of updates related to the Android platform.