Tag Archives: AlertDialog

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 remove title from AlertDialog in android?

By | July 24, 2012

Hello all.. Today I will show you two simple ways to remove title in an android alertdialog. Actually you can do this in two methods. Method 1 That takes a custom layot file, inflates it, gives it some basic text and icon, then creates it. Method 2 But it doesn’t work when creating an AlertDialog… 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 »

CustomAlert without any custom Layout in android.

By | February 6, 2012

We can create a dialog with custom alert dialog with our xml in android. But for making simple alerts we can make custom alerts through code itself. Here is a simple function for this. Here I am having a Listview and an edittext with two buttons in the alertBox. Please leave your valuable comments on… Read More »

Show Alert in cocos2D Android.

By | February 4, 2012

Here is a simple example showing alert in android cocos2D. For this I am using an example from my previous android cocos2D tutorial.. So please read that tutorial before reading this because the I am using the classes and files from it. I am only changing the Gamelayer.java file to show an Alert Dialog when… 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 »

Central aligning the default message text in AlertDialog in android.

By | January 30, 2012

Hello all.. Today I will show you how to align the message text to center in an AlertDialog. By default it is left aligned, so we have to get a reference to it to align it to center.This is how we do it. Please leave your valuable comments on this post.