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

By | March 20, 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 | March 15, 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 »

Quick Git Command you can use in your project

By | March 5, 2018

Here are some git commands that you will normally use in a git version controlled project repository. Commit For Commiting all modified files use git commit -am”Message” Status For checking the status of the git repository use git status Log For getting the information about the Git checkins use… git log To Print in a… Read More »

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

By | February 25, 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 | February 15, 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 | February 5, 2018

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 | January 25, 2018

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 20, 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 »

Special characters that can be included in a Swift String ?

By | January 5, 2018

Special characters can be included in string literals using the following escape sequences: The following example shows how to use a few string literals: Swift 4 Escape sequence Meaning \0 Null Character \\ \character \b Backspace \f Form feed \n Newline \r Carriage return \t Horizontal tab \v Vertical tab \’ Single Quote \” Double… Read More »

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

By | December 27, 2017

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 Count characters in a String in Swift 4?

By | December 20, 2017

To retrieve a count of the characters in a string, call the global countElements function and pass in a string as the function’s sole parameter: prints “sampleString has 32 characters” Note : Different Unicode characters and different representations of the same Unicode character can require different amounts of memory to store. Because of this, characters… Read More »

How Type Safety is implemeted in Swift 4?

By | December 15, 2017

Swift 4 is a type-safe language which means if a part of your code expects a String, you can’t pass it an Int by mistake. As Swift 4 is type-safe, it performs type-checks when compiling your code and flags any mismatched types as errors. Playground execution failed: error: :6:6: error: cannot assign to ‘let’ value… Read More »

Simple Alert with two buttons in iOS Swift with callback

By | December 1, 2017

Dear Friends, Today I will show you how to create a simple alert with two buttons and how to write a callback for each button. The code is simple. Its written for Swift 3. Send your comments to coderzheaven@gmail.com

How to add Deeplinks in your Android Application?

By | November 1, 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 | October 20, 2017

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 | October 10, 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 | October 1, 2017

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 | September 25, 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 | September 20, 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 »