How to record Audio using AudioRecorder in iOS Swift

By | February 12, 2017

Well, its really easy for recording audio in an iOS application. We will decalre two variables in our View Controller Request Permisson from the User Start Recording Set Delegate Finish Recording Note : Sometimes iOS Stops the recording when a phone call comes. In that case we need to handle this. Since the delegate is… Read More »

Using Different Media Libraries in Android

By | January 23, 2017

Android provides two main API’s for playing sounds. SoundPool MediaPlayer SoundPool SoundPool can be used for small audio clips. It can repeat sounds and play several sounds simultaneously. The sound files played with SoundPool should not exceed 1 MB. SoundPool does load the file asynchronously. As of Android API8 it is possible to check if… Read More »

Event Handling using DataBinding in Android.

By | January 14, 2017

Using data binding, you can also handle events right from the layout xml using either Method references, or Listener bindings. For this we can create a seperate Class named “MyHandler”. Event Handler Class MyHandler.java Like my previous examples you have to initialize the listener in the Activity. Layout Now the layout that has a button… Read More »

DataBinding in Android using Observable Collections

By | January 8, 2017

As I shown in the previous post where we used BaseObservable and ObservableField to update UI when binding object is changed, this post will show you another simple way to achieve this. Do Check my previous posts for better understanding of DataBinding and methods used in DataBinding. http://www.coderzheaven.com/2017/01/15/simple-databinding-in-android-example/ http://www.coderzheaven.com/2017/01/20/data-binding-in-android-using-observables/ http://www.coderzheaven.com/2017/01/25/data-binding-in-android-using-observablefield-to-update-ui-automatically/ Here is another way to… Read More »

Data Binding in Android – Using ObservableField to Update UI automatically

By | January 26, 2017

As I shown in the previous post where we used BaseObservable to update UI when binding object is changed, this post will show you another simple way to achieve this. Do Check my previous posts for better understanding of DataBinding and methods used in DataBinding. http://www.coderzheaven.com/2017/01/15/simple-databinding-in-android-example/ http://www.coderzheaven.com/2017/01/20/data-binding-in-android-using-observables/ Here is another way to do it. In… Read More »

Data Binding in Android – Using Observables (BaseObservable) to Update UI automatically

By | January 24, 2017

In the last example, you may have got an idea of what DataBinding is. If not please check my tutorial here… Simple DataBinding in Android Example. Updating Objects using Observables. In the last tutorial you may have noticed, if you update the object which is data binded, the change is not reflected in the UI… Read More »

Using GSON in Android – Simple Demo

By | January 18, 2017

GSON is open source Java library developed by Google. It is an API for converting a Java object to json representation and viceversa. Uses Converts any Java object i.e new object or any existing/legacy object, to JSON and vice-versa. Finest support for generic objects Simple, convenient methods for conversions No need of any annotation for… Read More »

Android Navigation Drawer Simple Example

By | March 6, 2017

Navigation Drawer helps developers for creating easy menus in an application. Lets start to see how it works. We will start by creating a new project with a navigation drawer activity. Adding Navigation Drawer Activity If you want to add Navigation Drawer Activity to your existing project you can simply add it by going to… Read More »

Simple DataBinding in Android Example.

By | January 15, 2017

This is a latest technique in Android where the UI is updated when the data bind to it changes, which is called databinding. DataBinding DataBinding has its own expression language for layout files. It corresponds to Java expressions and has quite impressive capabilities. Below you can see the list of all available operators: mathematical operators;… Read More »

How to call Android function from JavaScript?

By | December 30, 2016

Check the Video below to see what we are going to do… If the web page you plan to load in your WebView use JavaScript, you must enable JavaScript for your WebView. Once JavaScript is enabled, you can also create interfaces between your application code and your JavaScript code. Enabling JavaScript JavaScript is disabled in… Read More »

Loading webpages using JavaScript in Android WebView / Executing JavaScript functions from Android

By | January 10, 2017

I think everyone has checked my previous post on how to improve Android WebView performance. If not, check it here Improve Android WebView Perfomance Now we will see how we can load a webpage textfields with our custom values in Android WebView. For this I am using a sample HTML file which is stored in… Read More »

Understanding Shared Element Transition in Android.

By | December 27, 2016

Hi all, In Today’s tutorial we will see how we can do a shared element transition between activities in android. What we will do. We have two activities First activity has a TextView and two images. Second activity with two images. We will animation between corresponding images. Check out the video below to see what… Read More »

Material Design Circular Reveal Animation Demo in Android.

By | January 9, 2017

Material Design has changed the way users interact with the apps. Reveal is a new animation introduced in Android L that animates the view’s clipping boundaries. Reveal animations provide users visual continuity when you show or hide a group of UI elements. This animation is often times used in conjunction with a floating action button.… Read More »

Important Steps to improve WebView Performance in Android

By | December 20, 2016

A Quick note on WebView A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history,… Read More »

Introduction to Android Canvas – Simple Example

By | December 17, 2016

The Canvas can be used to draw graphics in android. It provides methods to draw oval, rectangle, picture, text, line etc. The Paint class is used with canvas to draw objects. It holds the information of color and style. In this example, we will draw some 2D Shapes. We will create class that extends View… Read More »

How to Solve No matching client found Error in Android Studio

By | November 23, 2016

No matching client found Error usually comes when you are using the FireBase SDK in your project. This is because you are missing the the ‘google-services.json’ file in your project. You may have added it, but in the wrong path. Android Studio will try to search for it in the ‘app’ directory. The Solution is… Read More »

Android studio : Gradle project sync failed error – How to Solve

By | November 23, 2016

This is the most common errors that we see in Android Studio and very often it is easy to fix. Just follow these simple steps File -> Invalidate caches / Restart Shutdown Android Studio Rename/remove .gradle folder in the user home directory Restart Android Studio let it download all the Gradle stuff it needs Gradle… Read More »

How to create a simple repeating Job using JobScheduler in Android.

By | July 23, 2018

JobScheduler class is used to schedule Jobs in Android. JobScheduler was added recently in API 21, so below that it will not work. Here is a simple example… Create JobScheduler Service We need to create the JobSchedulerService class at first. AndroidManifest Just like a service, we need to add this service in the AndroidManifest. Create… Read More »

onRequestPermissionsResult not called on Fragments in Android

By | June 21, 2022

This is a common mistake that people make when coding for marshmallow. When in AppCompatActivity, you should use ActivityCompat.requestPermissions; When in android.support.v4.app.Fragment, you should use simply requestPermissions (this is an instance method of android.support.v4.app.Fragment) If you call ActivityCompat.requestPermissions in a fragment, the onRequestPermissionsResult callback is called on the activity and not the fragment. If you… Read More »

Error Handling in Swift

By | October 1, 2016

When calling a method that may cause a failure, you normally pass it with an NSError object (as a pointer). If there is an error, the object will be set with the corresponding error. You then check if the error object is nil or not and respond to the error accordingly. That’s how you handle… Read More »