Singleton Design Pattern – A Creational Design Pattern


singleton design pattern

As the name suggest, Singleton mean ‘Single Instance’.  As it is a creational design pattern so this design pattern provides the solution for how to create only one object (instance) of a class throughout the application.That means you can restrict the creation of an object of a given class by providing a static member function to create only one object of that class.

Creational Design Patterns


singleton design pattern

This design pattern provides the process to create an object as per suitable for your requirement. It means you can control the creation and life cycle of an object in your application.  As we have already discussed about different creational design patterns in my previous post, lets have a recall about  the creational patterns as below and then we will discuss different types of creational patterns in next post.

Get Running Applications List in Android Example

get-installed-application-list-androidHere we will discuss about how to get running applications list in Android with an simple example. There are many applications and services which are running in your Android device. We can use ActivityManager.getRunningTasks(Integer.MAX_VALUE) API to get list of all running tasks in Android.

Get Installed Applications List in Android Example

get-installed-application-list-androidHere you will find the simplest way to get installed applications list in Android phone. We will retrieve all installed applications list using PackageManager and ResolveInfo in Android. ResolveInfo and PackageManager are Android components which will provide us all installed applications details.

Send Email From an Android Application programmatically

android-logoSend email from an Android application with example

Here we will discuss about how to send Email from an Android application programmatically. Simple we will use Intent.ACTION_SEND action with an existing email client like (Gmail or something else) to send the email. Here in our example we will take inputs from user ( like To, Subject, Message) and will send it by invoking any of the existing email client, which is already installed in your device.

Android Messaging Example for Sending SMS Programmatically

android-logoSimple way to Send SMS (Text Messages) from an Android Application.

Here we will discuss about how to send SMS from an Android application in a very simple way. Sending SMS from an Android application programmatically is really very easy. Lets have a line by line discussion for how to send massages in Android.

Android Analog Clock and Digital Clock Example with Code Description

android-logoUsing Android Analog Clock and Digital Clock in any Android Application is very easy. We just need to put the Android clock control in the xml file, Then it will automatically pick the time and show on the Activity screen. Here is the complete code.

Android AIDL Example with Code Description – IPC

android-logoBefore we learn about Android Interface Definition Language (AIDL), Let us know why it is required? The answer is very simple. Each Android app run in it’s own process. So one application can’t directly access another app’s memory space. If you want to access some data from one application to another application, then we need to use  inter process communication (IPC) like other platforms. So in Android IPC is otherwise known as AIDL.

Simple Android AlarmManager Example to Schedule an Event

android-logoAfter getting so many request from users for updating the post on how to use Android alarm to schedule an event. Here is the complete example with source code and description. My idea is to give you a better idea about how AlarmManager works in Android platform. To make the example very simple, in this example we will have an activity which contains a button call ‘Setup Alarm’. Just click the button and wait for 10 seconds. Our Alarm will be raise.

Vibrate Android Phone Programmatically

android-logoVibrating your Android phone programmatically is very easy. The code is common for all Android devices which has vibrator hardware. You can vibrate your Android device  using different pattern until you cancel the vibrator either by the Android OS or manually by your Android app. You can also download the complete source code from this post.

Please support the site
By clicking any of these buttons you help our site to get better