Tag Archives: context

What is Context in Android and What is the proper way to use it?

By | December 7, 2018

Lets see what a Context is… Context : Current State of the application. Context : Handle of the application. Context : Provides access to the resources, preferences, accessing database etc. Activity inherits from the Context. Context is the most important part of the Android application and its everywhere. If you wrongly use Context, it can… 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 »

Adding Notifications, Reading Notifications, Getting number of notifications in Android M.

By | February 20, 2016

This demo will show how to 1. Create and add a new Notification, 2. How many notifications are active in the current Application? 3. Delegate method for Notification Deletion. For Adding a Notification we can use the following snippet. For reading the number of currently Active notifications we can use To know when a Notification… Read More »

How to load a spinner with values from SQlite Database in android?

By | November 18, 2012

Here is a simple example showing how to load a database values in a spinner in android. OK we will start. This is the layout for the spinner row. spinner_row.xml This is the layout for the interface. activity_main.xml Now this is the MainActivity.java file that uses the spinner and the database. Join the Forum discussion… Read More »

How to delete a contact in android?

By | June 23, 2012

Hello all previously I have shown how to list all contacts in your phone and in another post I showed how to programatically create a contact in android. In today’s tutorial I will show you how to delete a contact in android programatically. This simple code does that.

Send Data when Clicking on a Notification in Android?

By | March 10, 2012

Hello everyone… I have shown in my previous tutorials on how to create notification in android and cancel it. This is the post showing this . Now today I am going to show how to send data when you click on the notification message. Here I am creating two activities. One the main activity that… Read More »

A Simple Layout with two listViews.

By | March 2, 2012

Here is a simple example to show two listviews horizintally in android. here is the java code that sets up the list. Here is the main.xml file. Here is the layout for each row in the list . Here is the complete source code for this example.

Custom GridView in android. A simple example.

By | February 29, 2012

Hello all……….. Android has been absoultely wonderful for customizing widgets. I have shown a lot of example to customize ListViews, spinners etc. Today I will show you how to customize gridviews. Using this method you can actually place anything inside a gridview even a webview also. So here we start. We customize a gridview by… Read More »

How to get the SMS sent to your emulator within your application? OR Get notified when an SMS arrives to your phone.

By | April 20, 2011

Actually these are done using services in ANDROID. These are called BroadcastReceivers.Your class has to extend the BroadcastReceiver class to get these broadcast events. But note that these services need to have an interface. So you will not see any UI on the device. But don’t think your application is not running or not installed.… Read More »

Context menu in android

By | March 16, 2011

What is context menu? Where it is used? How it is used? I will cover all these questions… Context Menu A context menu is conceptually similar to the menu displayed when the user performs a “right-click” on a PC. You should use a context menu to provide the user access to actions that pertain to… Read More »