Category Archives: ANDROID

Room Database from Google – A Simple Example

By | August 6, 2018

Lets talk about the Room Persistent Library from Google. The Room persistence library provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite. The library helps you create a cache of your app’s data on a device that’s running your app. This cache, which serves as your… Read More »

Implementing GCM in Android

By | April 2, 2018

Hi Friends, In this article I will be talking about how you can implement GCM in Android using FirebaseMessaging Service. Below are the steps you need to follow… Create Project in Android Studio Create a new project in Android Studio. The package name we use here will be used in the Firebase Console. Create Project… Read More »

Working with SMS in Android, Read Messages from Inbox and Get Notified on new Incoming messages

By | April 2, 2018

Permissions Add these two permissions in the Android Manifest Read SMS from Inbox Reading SMS from inbox is not a big task, but your user needs to allow it if you app is running on Marhmallow or more. if you app is below marshmallow, then you wont need it. But here we will write one… Read More »

What is ButterKnife?

By | January 13, 2018

What is ButterKnife? Its a kind of view injection in Activities or Fragments using Annotations. Butterknife can be used to 1. Bind Views 2. Bind Clicks 3. Can be used with resources like strings, colors, Dimens, Drawables etc. Below are the annotations available AnnotationDescription @BindView Binds view object. TextView, Button, Spinner or any view object… Read More »

Why you should use StringBuilder instead of StringBuffer in Android for better performance?

By | January 1, 2018

StringBuffer StringBuffer is mutable means one can change the value of the object . The object created through StringBuffer is stored in the heap. StringBuffer has the same methods as the StringBuilder , but each method in StringBuffer is synchronized that is StringBuffer is thread safe.Due to this it does not allow two threads to… Read More »

Using Otto Event Bus to Communicate b/w Activity and Fragment.

By | January 1, 2018

Using Otto Event Bus to Communicate b/w Activity and Fragment. Otto Event Bus is an Android Library that helps developers to communicate between Android Activity and Fragment and vice-versa. Lets see a simple implementation of this. Here I will pass a simple string from Activity to Fragment and Vice-versa. Gradle Layout Activity layout Fragment Layout… Read More »

Implementing Downloadable fonts in Android – Kotlin.

By | December 29, 2017

Here is a simple example in which we will download a font from google and set it to our textview. View the Demo here Layout Here is our layout. The Edittext is a autocomplete textview where we will load the font names to download. The font names are stored in values.xml Lets see the layout.… Read More »

How to BackUp user’s data programatically in Android?

By | December 29, 2017

Android’s Backup service allows you to persist the data in a Google cloud storage. Android does this with the help of a BackUpAgent in the SDK. If we want to backup the data, then extend the BackupAgent. Lets see how we can do this. Benefits Reduce user frustration Increase login-rate. Reduce support calls Minimize user… Read More »

Simple Job Scheduler Demo in Android

By | January 10, 2018

Android helps us to schedule jobs in an efficient way. Android has a built in Job scheduler for this. Lets see how this is done. Before that lets see what google has to say about Job Scheduling. These are the normal tasks an application does : Updating network resources. Downloading information. Updating background tasks. Scheduling… Read More »

Store a Class object in Android Preferences or Store Non-Primitive types in Android Shared Preferences

By | January 1, 2018

We all know that Android only allows primitives types like int, float to be stored in preferences. But we can change this with the help of GSON. If you want to know more about GSON, you can refer my post here… Using GSON in Android – Simple Demo Now, In this demo, I will show… Read More »

How to add Deeplinks in your Android Application?

By | October 2, 2017

What are Deep Links? Let’s understand this with the help of a situation. If you happened to click a link on a webpage and suddenly it opens an application inside you phone or opens a dialog asking you to choose an application to handle this click. Yes, this is called deep linking. You can read… Read More »

Useful Android Studio Plugins

By | January 1, 2018

Here are some plugins that are really handy for developers to speed up their development. 1. ADBWIFI This plugin helps you to debug your app over Wi-Fi. Check out my previous blog post on how to do this without any plugin. 2. DTO generator This plugin is useful when you want to generate corresponding POJO… Read More »

How to Create Preferences Settings in your app using Android Built-in Settings Preference APIs

By | August 14, 2017

There is often a settings page when we make our app and most of the people end up making it using their own UI. But interestingly Android provides API specific for building preferences using your own values. Check the below UI for my settings Lets see how that is done. Using Preference Headers Preference Headers… Read More »

Steps to Speed Up/Optimize Android Studio Gradle Build Process.

By | April 21, 2018

Even with good hardware configuration for the system, we often end up with slow gradle build process in Android Studio. So here I will discuss some steps to Speed up Android Gradle build. 1. Stay Up to Date Make sure you have the latest Android Studio and have the latest build tools updated. 2. Create… Read More »

Get Battery Percentage in Android – Different Methods

By | July 20, 2017

We will see the different ways to get the battery percentage in Android. Method 1 Register a Broadcast Receiver Receive like this Method 2 Method 3 Note : Make sure you unregister the receiver when you don’t need.

How to Debug/Run Android application in Android Studio Wirelessly using Wifi.

By | July 19, 2017

Steps Enable usb debugging and Connect the device to dev system with USB cable. Type “adb tcpip 5555” in Terminal/Command prompt. (Here we are opening a port in device to connect from development system.) Disconnect the phone and check the ip address of phone from network settings Type “adb connect :5555” Now the phone will… Read More »

Do we need to call the Garbage Collector manually ( System.gc() ) in Android?

By | July 28, 2017

This is a common question. Eventhough the Android System calls garabage collector at appropriate times, this usually will not be adequate. Because the system calls GC at intervals, most of the time it wont work perfect and causing unnecessary pauses in the application. If these pauses are more than 16ms, then the user will notice… Read More »

How to write Simple Animation while setVisibility.GONE in Android?

By | June 25, 2017

Automatic animations on Layout Change If you want to animate views in a layout without writing big codes. Here is a Simple way. Find the root element of the layout and add this property to it. Adding Manual Animations Fade Out Animation Fade In Animation Move Down by height Translate animate to origin Position Adding… Read More »

How to add finger print authentication in Android.

By | June 21, 2017

Android 6.0 saw the introduction of fingerprint authentication, a new security feature that allows users to confirm their identify with a single touch. Well, after that this has become a common way of authentication for users. Advantages Very easy, fast and convenient to use for authentication Don’t need to remember No struggling with the keyboards… Read More »

How to find location in Android using GPS?

By | June 11, 2017

This example helps you to find the location in Android using the GPS. I have commented out some functionality in the code. You can uncomment it and extend it at your wish. At first we will create a utility class that will handle all GPS related Operations. GPS Utility Class This class has all utility… Read More »