Android show alert window with button

I am learn about android programming in my free time. I am planned to create a simple alert window with a button. We can use AlertDialog class to create android alert window in Android. The sample output using this class as like picture below.

Android_alert_windowI have created a simple function how to create Android alert window using AlertDialog class. Please check this subroutine :

We can give parameter to this Android alert window subroutine to give same result like picture above using command :

I hope this simple subroutine can give you more explaining about how to create alert window in Android.