Android Activity Dialog

Android Activity Dialog

Here we will learn how to use Android Activity Dialog. Here We will learn the simplest way to display an Android activity as a Dialog.  When you will display the android activity as a dialog, it will work as a modal dialog. That means user can’t access it’s parent activity unless until the  dialog activity will be destroyed. Once the dialog activity will close, then only it’s parent activity will get focus.

Android Activity Dialog Code Snippet

You need to add the below code snippet with your activity entry in your android Manifest.xml file. That’s it.

 Remove Title of an Activity

If you want to remove the title of your dialog activity, then add below line before  ‘setContentView()’ in your activity java file.


Note: Here ‘ActivityTwo’ is  the java class file name in my example, which is used for a dialog. The above code snippet should be in the Manifest file.

Android Activity Dialog Example with Source Code

Here we will discuss about How to show an Android Activity as a Dialog with example. We have taken 2 activity in the attached example to show an activity as a dialog. In the example when we will click on a button from the first activities, then we will show the second activity as a dialog. We added one Edittext and 2 Buttons in the second activity for the test purpose only.

Show Android Activity Dialog  Code  Snippet

We have 2 activities names ActivityOne and ActvityTwo.  Find the complete code below.

1. ActivityOne.Java File.

 2. File

 3. main.xml file for File 

4. activity_two.xml file for File 

 5. AndroidManifest.xml for the Example


That’s it, now you can download complete example form below.

downloadDownload Android Activity Dialog Example with Complete Source Code from Here

For other Android Dialogs Click below links.

Alert Dialog in Android Example with Source Code and Description

Alert Dialog with EditText in Android Example with Source Code

I hope this small tutorial on ‘Android Activity Dialog’ will help you at it’s best.


Post By SmrutiRanjan (57 Posts)

Working @ Samsung as a Project Lead for Android Smartphones. I have been blogging since 2008. Previously I was writing articles for other bloggers, but finally I have started my own blog-"Techblogon".I am also an active contributor for the blog-"Gadgets n Gizmos World". Job is my necessity, but blogging is my passion.

Website: → Techblogon


One Response to Android Activity Dialog

  1. gues says:

    please remove your twitter bird it is disturb

Leave a Reply

Your email address will not be published. Required fields are marked *

− two = 7

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">