1. Introduction :

Generally we see popup boxes appearing in the apps showing alert messages or system errors. And also sometimes we can enter data into these windows which can be further processed depending upon our requirement.




You can see the below window which is the popup we are going to learn in this tutorial.

The popup box intakes a text i.e., your name and will display a toast when ok button is clicked and popup box is closed when cancel button is clicked.

And also you can notice we have placed a logo and heading you can change the design according to your requirement. We can also display listview in the popup box that we will see in our further tutorials, not only listview we can show maps, images, and many more….

2. Creating activity_main.xml :

Add a textview and a button to the activity.


3. Creating MainActivity.java :

We will be calling the pop up box on button click in mainactivity.


4. Creating popup.xml :

Now we will be creating popup activity by adding imageview for logo and textviews, button and edittext for accepting text to be displayed as toast.


5. Creating popup.java :


Initialize buttons, edittext and setOnClickListener for two buttons.


6. AndroidManifest :

Add popup activity as



7. Output :

popup3 popup2

Share article on

Show Buttons
Hide Buttons

June 25, 2017

Attention Required! | Cloudflare

One more step

Please complete the security check to access push.wppush.co

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this in the future?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Clear all
Read previous post:
Android Tutorial on AutoCompleteTextView