Tag Archives: savedInstanceState

How to handle configuration change in an activity using Fragments in android?

By | October 6, 2013

Here is a simple example in which we will save or retain the state of the progress using fragments. Note : We have handle a configuration by another way – by ignoring the change i.e using this property in the activity tag android:configChanges=”” By using this android ignores the configuration change and will never try… Read More »

How to write a custom content provider in android? with a sample application using our own custom content provider.

By | September 22, 2013

Hello all we all know what are content providers right? Those who are unaware of content providers please visit this link http://developer.android.com/guide/topics/providers/content-providers.html In a breif content Providers are Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface… Read More »

Faster Loading images in GridViews or ListViews in Android using Menory Caching, Complete implemenation with sample code.

By | September 1, 2013

Hi all This example shows you how to load large images in the gridview without any lag or without outofmemory error. This sample application uses the LruCache to hold the images. A cache that holds strong references to a limited number of values. Each time a value is accessed, it is moved to the head… Read More »

What is a Memory Heap Size in android? and how can use Bitmap Efficiently?

By | August 25, 2013

Memory Heap Size Android is a full multitasking system so it’s possible to run multiple programs at the same time and obviously each one can’t use all of your device memory. For this reason there is a hard limit on your Android application’s heap size: if your application needs to allocate more memory and you… Read More »

Use of custom animations in a FragmentTransaction when pushing and popping a stack. or How to apply animations in Fragments when pushing on to a stack?

By | June 13, 2013

Hello all We have seen many examples of how to use fragments in android. You can search coderzheaven for all types of transactions using Fragments. Today in this post we will see how we can apply animations to Fragments when pushing on to a stack. This is fairly a long example. I will try to… Read More »

How to send Data between two individual applications in Android?

By | April 1, 2013

We can send data between two individual applications in Android if the receiving application is configured to received that type of data. For example if an application is to receive Image data then it’s manifest should contain the ImageFilter as Shown below For example ac activity in the receiving application is named “Receiver” then its… Read More »

Using DialogFragments in Android – A Simple example.

By | February 14, 2013

A little on Dialog Fragments A fragment that displays a dialog window, floating on top of its activity’s window. This fragment contains a Dialog object, which it displays as appropriate based on the fragment’s state. Control of the dialog (deciding when to show, hide, dismiss it) should be done through the API here, not with… 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 »

Changing the style or theme of default alertDialog in Android.

By | February 3, 2012

Hello everyone, Here is a simple example showing how to change the theme of default AlertDialog in android. Check this post before for understanding how to use styles. http://www.coderzheaven.com/2012/04/17/inherit-styles-extend-styles-android/ To start first create a fresh project named AlertTest. In the AlertTestDemo.java file copy this code Now create a file named “styles.xml” inside the res/values folder… Read More »

Saving TextFile to SDCARD in android?

By | January 29, 2012

Hello android lovers, In today’s tutorial I will show you how to 1. Create a text file and save a textfile in your SDCARD in your preferred path. 2. Read the contents from the same file and show it in a TextView. For writing a file we use the FileWriter class and for reading the… Read More »

TextView with link in ANDROID…….

By | May 10, 2011

Hi all……. All of you may be familiar with TextViews in ANDROID. But how many of you know that we have have html as text in a textView. This post is a simple example to show this. Create a fresh project and copy this code to the main java file. The main.xml The AndroidManifest.xml file

How to split a String in ANDROID?

By | May 5, 2011

Hi all….. Splitting a string in android is really easy.checkout the following snippet. Check the Logcat for output. Note: Make sure to put the escape character before the delimiter for splitting,otherwise the output may be each character.

How to check SDCard free space in ANDROID?

By | April 19, 2011

This is a simple example that shows how many bytes are free in your SDCard. Inorder to run this example, you have to create an SDCard and start the emulator with the SDCard. Now create a fresh project and name it “FreeSpaceActivity.java” and copy the following code to it. The main.xml file AndroidManifest file Please… Read More »

Text to speech in ANDROID, A Simple Example.

By | April 9, 2011

Hello everyone…….. In this simple example I will show you how to use Text To Speech in ANDROID. This is one of the unique features in ANDROID. Unlike iPhone , ANDROID has a built in TTS Library which supports many languages. But iPhone doesn’t have this feature. They have to depend on third-party software for… Read More »

How to open browser in an ANDROID application? How to open a URL from an ANDROID application?

By | March 28, 2011

Hi all,In this tutorial I will show you how to open browser from an ANDROID application. This is done through intents. You know that intents are used to invoke other activities. So we here invoke the browser activity. The following code will open the default browser in your ANDROID phone. This is the manifest file… Read More »

Play Video using VideoView in ANDROID.

By | September 19, 2010

Playing a video file is simple in android. This post will help you. Put your video in res/raw folder. If no raw folder present then create a new folder inside res. The main. xml file. Please leave your comments if this post was useful.