Tag Archives: Public Void

How to create a Slide from Left animation while deleting a row from a ListView in Android?

By | September 12, 2012

Hello all…… I have written a lost of posts on Listviews. You can see that by just searching Listviews in my site. Today I will show you how to create a slide out animation while we delete a row from a ListView. So this is the xml that contains the ListView. Let it be in… Read More »

How to read and write files to SDCARD and application SandBox in Android – A complete example?

By | September 6, 2012

Here is a complete example of How to read and write files to SDCARD and application SandBox in Android. First create a new project and inside the mainActivity paste this code. Now create another class named MyFile.java and copy this code into it. Now the layout for the xml file. Note you should give this… Read More »

How to start with ActionBar in Android?

By | August 23, 2012

With Android 3.0 Google eliminated the need of hardware menu button which is replaced by Action Bars. Here is a quick example on how to use ActionBars. First create a new project and name it ActionBarExample. Now create a folder named “menu” in res folder and create a new XML file inside it named “action_bar_menu.xml”.… Read More »

How to stream an audio in Android?

By | August 14, 2012

This is a simple example to how to stream an audio in android. Here is the java code for that. This is the xml that contains the button. When you run this program you will see a button and on clicking on that button you will see a dialog with message “Buffering…..”. Once the buffering… Read More »

How to load an image from the assets folder in android?

By | August 9, 2012

Here is a simple example showing how to load an image stores in assets folder in android? Done.

How to read a serialized object from a file in the raw folder in android?

By | July 30, 2012

In my previous post I showed how to serialize an object and save it in sdcard in a file and retrieve it. Pull out the file from the sdcard and then create a folder named “raw” inside the “res” folder and copy it. This example shows how to retreive it when it is in the… Read More »

Serialization in Android – A Simple example.

By | July 25, 2012

Serializing a class file provides a fast and efficeint way to store information produced by your application! What is serialization? Serialization is essentually taking a screenshot of a class file and its contents. For example, lets say you have the following class: Now we will save this data to a file in the SDCARD. Make… Read More »

A Simple FlashLight Application.

By | July 20, 2012

Here is a simple Application on how to use flashlight in android. Now the layout file main.xml. AndroiManifest.xml file contents. Make sure to add the permissions. Download the android java source code from here. please leave your valuable comments on this post.

How to make a http call repeatedly from a service in android?

By | July 14, 2012

We may have applications in which we may have to make repeated calls to a webservice. At that time services may be useful. This is such an example in which we will be creating a Service in android to create a repeated call to a webservice in a time delay of some seconds or milliseconds.… Read More »

Creating a custom Sliding GalleryView with Paging in android

By | June 28, 2012

This is a simple example showing A sliding Gallery in android. This example shows a sliding gallery with a paging Control and a changing page text which also indicate the page change. Create a new project named “SlidingGallery” and copy this code into “SlidingGalleryDemo.java“. My Activity name is “SlidingGalleryDemo.java” here. Now create a new class… Read More »

How to add a new contact programmatically in android?

By | June 18, 2012

We all know how to add a new contact to our android devices without programming right. OK that’s a normal man’s use. But what from a programmer’s view. This is the sample java code that helps you to add contact programatically. After running this programs please switch to contacts application on your device to see… Read More »

How to get Notified when a widget is deleted?

By | June 10, 2012

I have already covered a tutorial on how to start with widgets and how to create a simple widget here.. http://www.coderzheaven.com/2012/06/07/create-widget-android/ Today I will show you how to get notified when a widget is deleted. if you have already gone through my previous post, then there is only a small change in the “MyWidget.java” file.… Read More »

How to override hardware Home button in android? OR How to listen to home button click in android?

By | June 2, 2012

Hello everyone… In this post I will show you how to listen to hardware button in an android smartphone. This post especially shows how to listen to the home button in android. But my advice is never override the home button in your app. Home button is to move the currently running process to background.… Read More »

How to use Accelerometer in Android?

By | May 30, 2012

This is a simple post showing how to use accelerometer in android. This java code prints the values of x,y and z axis in the console. Leave your comments on this post. Find Coderzheaven on facebook, twitter , google Plus and MySpace for more updates.

How to add checkboxes and radio buttons to ListView in android? OR How to set single choice items in a ListView in android?

By | May 25, 2012

To create a list of multiple-choice items (checkboxes) or single-choice items (radio buttons) inside the dialog, use the setMultiChoiceItems() and setSingleChoiceItems() methods, respectively. If you create one of these selectable lists in the onCreateDialog() callback method, Android manages the state of the list for you. As long as the Activity is active, the dialog remembers… Read More »

How to create CustomProgressBar in android – Part 3?

By | May 23, 2012

Hello all… In my previous posts I have shown two methods to create custom progressbar in android. Check out these tutorials to find out how? 1. How to build a custom progressBar in android- Part 2? 2. Custom progressbar in android with text – part 3 Today in this post I will show you a… Read More »

Custom progressbar in android with text – part 3

By | May 18, 2012

Hello all…… I have posted two posts on how to customize a progressbar in android. 1. Custom Indeterminate progressBar for android? 2. How to build a custom progressBar in android- Part 2? Here is another one with update text on top of the progressbar. Here is how we start. After creating a fresh project create… Read More »

How to build a custom progressBar in android- Part 2?

By | May 12, 2012

Hello all……. Today I am going to show you how to create a custom progressbar in android. Previously in another posts I have already shown how to build a custom indeterminate progressbar in android. And in this post I will show you how to customize the horizontal progressbar. OK Now we will start. First create… Read More »

How to download a file from a remote site in android? – Another simple example – Method -3

By | May 7, 2012

Hello all ……. I have shown many examples on how to download and upload files in android through this site. These are other methods for downloadign a file in android. 1. How to Download an image in ANDROID programatically? 2. How to download a file to your android device from a remote server with a… Read More »

How to download a file to your android device from a remote server with a custom progressbar showing progress?

By | April 29, 2012

Actually this is really simple. I have already posted an example for how to download a file in this post. How to Download an image in ANDROID programatically? This is another one little different with a progressbar included. Previously I have shown three other methods to upload files to a server. Check these posts to… Read More »

JSON IN ANDROID.

By | April 26, 2012

Complex JSON String parsing in ANDROID http://www.coderzheaven.com/2011/06/10/complex-json-string-parsing-in-android/ Parsing JSON Object in ANDROID. http://www.coderzheaven.com/2011/06/09/parsing-json-objects-in-android/

How to explicitly free memory in android OR Release unwanted memory in Android?

By | April 24, 2012

If you are writing memory consuming applications there is a bigger chance that your application may be running out of memory after sometime. So there are some methods in android that invokes the garbage collector explicitly. See the following function which invokes the garbage collector to free a lot of memory. A little explanation about… Read More »

Using Tabbars in ANDROID, A Simple Example……….

By | April 22, 2012

This is a simple example showing how to use tabbars in ANDROID. First create a new project and copy this code to it. Now create three another java files by right clicking the src folder and name it FirstTab.java, SecondTab.java, ThirdTab.java. Now copy the following code to FirstTab.java. SecondTab.java Now ThirdTab.java. Main.xml file AndroidManifest.xml You… Read More »

Select an Image from gallery in ANDROID and show in an ImageView.

By | April 20, 2012

Hi all In this tutorial I will show you how to get an image from your phone gallery and show it in an imageview.Here we use intents to open up the image gallery and get the image URI.   Demo   Watch Video Tutorial   Steps : Ask storage permission from the user if the… Read More »