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 simultaneously access the… Read More »
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 Register and unregister… Read More »
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. Font Family names… Read More »
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 attrition Sustain user… Read More »
For API above 19 For API from 11 to 18 For API below 11 Check this post to show the image selected from gallery in an imageview.
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 Quote \000 Octal… Read More »
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 you how to… Read More »
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 in Swift do… Read More »
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 ‘myVar’ myVar =… Read More »
Dear Friends, In Today’s post I will show you how to convert a simple hex color string to UIColor in Swift 3. Code
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 email@example.com
Life is good and everything will be ok, Kotlin is here… In this article we will check how we can start with Kotlin for Android. Make sure you won’t overwrite your old Android Studio when you install the new version. Method 1 : Pre-requisites First you have to download Android Studio Beta 3.0 from here. Android Studio has… Read More »
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 more about deep… Read More »
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 classes for your… Read More »
Here is a simple ulility function to convert a hex color string to UIColor in iOS in Swift 3.
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 displays only the… Read More »
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 a build variant… Read More »
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.
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 be connected with… Read More »
ng-repeat. Example Now we will do a filter Search Filter In the above example if we want to search by country we will modify the code like below will search in country fields of the employees only and the boolean value from the checkbox will look for the exact match from the checkbox. Complete Example
This is a simple demo to do Slide to Unlock in Android. Layout Activity
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 some lag in… Read More »
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 Duration Chaining Animations… Read More »
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 No more password… Read More »