Callbacks the very essence of asynchronous JavaScript programming

Introduction

In earlier days of programming every thing was sequential when one operation needed to wait for the others above it to finish. In situation like those of some priority task had to be done then it had to wait for a long to execute the next. So Callbacks and asynchronous programming are the new market introductions.

Description

Callbacks can be in simpler term visualized as a reminder to the Event loop that this has to be executed after a specific interval. As a result after the interval is reached the callbacks get executed on the highest priority basis (But still there’s some limitation which you’ll get to know reading further).

These call backs can be of two types:

–  Blocking callbacks (also known as synchronous callbacks or just callbacks)
–  Deferred callbacks (also known as asynchronous callbacks)

Continue reading

Advertisements

RESTlient Using Service- An Android Mobile Reads

In this blog I will show you how to call REST API through a service. First question come to your mind that Why Service one use AsyncTask to call REST. Well, you can do that if you want to frustrate your user by calling same request again and again.

Basically the role of service is to continuously run in background without worrying about application process, or user interaction with application.

RESTService is made to implement as a subclass of services, while the services are meant to encapsulate longer running operations in an android app, they are not inherently threaded. This is something that often confuses new android developers. So we will create a new thread whenever new API request is fired. Here is the details of the code snippet

Continue reading

Displaying Single and Multiline Message label using Corona SDK

Introduction: On every other application we need to use label in order to display custom message to the screen. I am going to demonstrate in this blog how can we add a single line and also multi line label to a screen using corona SDK.

Description: Corona SDK actually provides a framework using which we can make cross-platform mobile application like app for IOS and Android. Its provides several API libraries. One of those API is ‘display’ which have a function called newtext() using which we can display a label to any screen.

Continue reading