Posts

Showing posts with the label Alert Dialog

AlertDialog with custom layout (Kotlin)

Image
How to create Create AlertDialog With Custom Layout (Kotlin)?      DESCRIPTION      This tutorial will show how to create and show an AlertDialog with C ustom Layout containing views such as EditTexts and Buttons etc. We will show AlertDialog on Button click. Custom layout will contain three EditTexts and two Buttons . When information is entered in EditTexts , Press Login Button , Dialog will be dismissed, and the information will be set to the TextView .      VIDEO           SOURCE CODE      Step 1:  Create a new Project  or  open new project Step 2: Create new Layout Resource file 'login_dialog.xml' under res>layout folder Step 3: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:too...

Create AlertDialog With Custom Layout Programmatically (Kotlin)

Image
How to create Create AlertDialog With Custom Layout Programmatically (Kotlin)?      DESCRIPTION      In this tutorial we will create AlertDialog with custom layout programmatically in Java using Android Studio IDE. We will create a button to show that AlertDialog and show output in a TextView. You can also display this information anywhere or save at some place like shared preferences, files, sqlite etc. I've added two TextViews and Two EditTexts with LinearLayout.      VIDEO           SOURCE CODE      Step 1:  Create a new Project  or  open new project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" ...

Create AlertDialog With Custom Layout Programmatically

Image
How to create Create AlertDialog With Custom Layout Programmatically (Java)? In this tutorial we will create AlertDialog with custom layout programmatically in Java using Android Studio IDE. We will create a button to show that AlertDialog and show output in Toast . You can also display this information anywhere such as TextView etc or save at some place. Step 1:  Create a new project   OR   Open your project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" tools:context= ".MainActivity" > <Button android:id= "@+id/showAlertDialogBtn...

How to create a MultiChoice AlertDialog in Android (Kotlin)

Image
     DESCRIPTION      In this tutorial we will create a MultipleChoice AlertDialog using Android Studio . We will show list of colors to show in dialog. We will create a Button to show that AlertDialog , and a TextView to show the selected items...      VIDEO           SOURCE CODE      Step 1:  Create a new project   OR   Open your project Step 2: Code activity_main.xml <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:padding= "20dp" android:orientation= "vertical" tools:context= ".MainActivity" > <Button android:id= "@+id/showsnackbarbtn" android:text= "Show Alert Dialog" andro...

How to create a SingleChoice AlertDialog in Android (Kotlin)

Image
     DESCRIPTION      In this tutorial we will create alert dialog with single choice from list of items. We will create a button that show alert dialog when that button is clicked, a TextView that shows the selected item from dialog.      VIDEO           SOURCE CODE      Step 1:  Create a new project   OR   Open your project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:padding= "20dp" android:orientation= "vertical" tools:context= ".MainActivity" > <Button android:id= "@+id/showAlertDialogBtn" android:t...

Create Alert Dialog (Kotlin) - Android Studio

Image
      DESCRIPTION       In this tutorial we will use Alert Dialog to alert the user whether you want to perform specific function or not. Alert Dialog will contain icon, title, message and two buttons "Yes", "No". We will show a alert dialog on button click. Android Alert Dialog (Kotlin)       VIDEO             SOURCE CODE       Step 1:    Create a new project   OR   Open your project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:padding= "20dp" tools:context= ".MainActivity" > <Button android:id= "@...

How to create a SingleChoice AlertDialog in Android

Image
In this tutorial we will create alert dialog with single choice from list of items. We will create a button that show alert dialog when that button is clicked, a TextView that shows the selected item from dialog. Step 1:  Create a new project OR Open your project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:padding= "20dp" android:orientation= "vertical" tools:context= ".MainActivity" > <Button android:id= "@+id/showsnackbarbtn" android:text= "Show Alert Dialog" android:layout_width= "match_p...

How to create a MultiChoice AlertDialog in Android

Image
In this tutorial we will create a Multiple Choice Alert Dialog using android studio. We will show list of colors to show in dialog. We will create a button to show that AlertDialog, and a TextView to show the selected items... Step 1:  Create a new project OR Open your project Step 2: Code: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:padding= "20dp" android:orientation= "vertical" tools:context= ".MainActivity" > <Button android:id= "@+id/showsnackbarbtn" android:text= "Show Alert Dialog" android:layout_width...