AlertDialog via Fragment: Android Programming @DrBFraser
AlertDialog via Fragment: Android Programming  @DrBFraser
Uploaded February 2017 | Updated September 2026, 2 weeks ago
Create an AlertDialog using AppCompatDialogFragment. Interact with the parent activity by setting text in a TextView, and by closing it with .finish().

Steps:
- Setup MainActivity with a TextView to edit, and a button to trigger the dialog box.
- Create a layout XML file for the dialog's appearance
- Create a Java class inheriting from AppCompatDialogFragment to build the AlertDialog
- Show the AlertDialog from main using a fragment manager.
- Add a cancel button
- Call .finish() on the parent activity to close it.
AlertDialog via Fragment: Android ProgrammingConnect/Remove Beaglebone Capepthreads #1: IntroductionOptiTune: Remote Desktop SupportGit in Android Studio (basic): Android Programming
Brian Fraser |

AlertDialog via Fragment: Android Programming

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER