1 00:00:04,380 --> 00:00:05,987 G'day everyone, welcome back. 2 00:00:05,987 --> 00:00:10,320 Okay let's have a look at how we can add some dialogues to our app. 3 00:02:11,540 --> 00:02:27,180 There's a Google guide to dialogues at https://developer.android.com/guide/topics/ui/dialogs.html 4 00:02:27,180 --> 00:02:30,340 that's worth a read after you've watched these videos. 5 00:02:30,340 --> 00:02:39,500 This document mentions three dialogue subclasses; AlertDialog, DatePickerDialog and TimePickerDialog. 6 00:02:39,500 --> 00:02:44,560 Unless you want the user to select a date or a time, which we will be doing later, 7 00:02:44,560 --> 00:02:47,280 you'd normally use an AlertDialog. 8 00:02:47,280 --> 00:02:53,220 We'll be following the advice in this document, but I'm not going to read through it all here in the video. 9 00:02:53,220 --> 00:02:59,740 There are a couple of things worth noting, though. Firstly, there's a link to a dialogs design guide, 10 00:02:59,740 --> 00:03:03,040 in the design call-out at the top of the document. 11 00:03:03,040 --> 00:03:09,320 That link describes the purpose and use of dialogs in a material design context. 12 00:03:09,320 --> 00:03:12,340 It's well worth reading when you come to create your own. 13 00:03:12,340 --> 00:03:19,540 There are some great examples of different dialog types, and advice on do's and don'ts when creating dialogs. 14 00:03:19,540 --> 00:03:21,840 Okay, back to the dialogs guide. 15 00:03:21,840 --> 00:03:24,880 There's a Contents box on the right hand side, 16 00:03:24,880 --> 00:03:30,440 and I wanted to mention the Passing Events Back to the Dialog's Host link. 17 00:03:30,440 --> 00:03:34,680 I won't go through this here, because we'll be covering it all in the videos, 18 00:03:34,680 --> 00:03:40,600 but it's another example of how important callbacks and interfaces are in Android development. 19 00:03:40,600 --> 00:03:45,020 Our dialog will let the user decide whether to perform an action or not. 20 00:03:45,020 --> 00:03:49,840 To start with, we'll be asking our user to confirm the deletion of a task. 21 00:03:49,840 --> 00:03:56,760 So we'll need some way for the calling activity to know which button was tapped, and for that we'll use callback. 22 00:03:56,760 --> 00:04:01,540 The final thing I want to look at here is right at the end, dismissing a dialog. 23 00:04:01,540 --> 00:04:07,540 I'll be coming back to this once our first dialog's written, so we can see the exact behaviour. 24 00:04:07,540 --> 00:04:11,960 That will also explain how we know to code things the way we're going to. 25 00:04:11,960 --> 00:04:16,820 In the next video, we'll create a general-purpose dialogue class for our app. 26 00:04:16,820 --> 00:04:21,339 It'll let us use the same class, whenever we want the user to confirm an action. 27 00:04:21,339 --> 00:04:24,160 See you in the next one.