All right, so let's get to the final dialogue that I wanted to look at in this section, and that's
the custom progress dialogue function.
And that is the function that I'm using in order to create this custom progress dialogue, which is
this progress here and it's a custom one.
So there was one back in the day that you could automatically use an android, but now there's, well,
it's deprecated, so you need to have a little workaround here, and that's what we're doing.
So I'm going to show you how to create this thing because we are going to need it for our application
when we have a background process which needs to run and we don't want to use it to do anything while
that happens.
So in this case, it's a very short one because we can anytime cancel it.
But let's get a look at how we can build this thing.
So first of all, I have this little function and it's called once I click on this button here, which
is this button custom progress dialog.
So once we click on it, I call this function custom progress dialogue function, and you could of course,
call this one custom progress dialog view or appearance or something at that.
But basically what it does is it creates a dialog.
All right.
And I call this one custom progress dialog.
But here I set the content view to be Are layout dialog custom progress?
So what is this dialogue custom progress?
Well, it's another layout file, and it's another one that I created myself.
So you can create this as you like.
It has to, of course, fit in the screen, but other than that, you can create whatever you want.
What, of course, makes sense is to have a progress bar.
So maybe you want to have a progress bar, which the user needs to see in order to see how far the progress
is.
I mean, how far to download, for example, has done or how far the upload is and how far the user
is with whatever process he wants to finish.
And then you can use a progress bar and the progress bars are pretty cool feature.
They have a bunch of cool properties here that you can assign and use.
But if I want to know more about progress bars, then I would really recommend to check out their progress
bar documentation.
For example, if you're wants to set the progress director, you can set it here to 25 percent, for
example, and so forth, so you have a bunch of options that you can play around with.
As you can see, it's a very long class once again, so a bunch of different attributes that you can
look at and so forth.
All right.
OK, so let's get back to the code that we have the progress bar, which is this little icon here.
Let me make it a little bigger so you can see it.
This I can that will constantly move around because we're not controlling it otherwise, and we just
wanted to move like that.
And then we have this text view which just says, Please wait, OK, and this text you is in black.
It's six p.m..
But what's interesting here is that it's within a linear layout where I have the gravity set to center,
so the two are next to each other because the orientation is set to horizontal.
So that's why the two are just perfectly next to each other, and the progress bar has a margin end,
which means and margin to towards the right, which gives it some space to this place.
White text.
OK, so that's basically the XML file, and as I said, you can customize it as you like.
And then the only thing we do is we say custom progress dialogue, dot show.
So we're just showing that dialogue and dialogues.
They.
I have, of course, some other options, as we saw before.
So you can adjust it as you please.
But in our case, when we click on it.
It just appears in the middle, and then I can click it away, but you can, of course, force it not
to get away or go away once you click on it.
But most of the times you will use that for something super short because you don't want to freeze the
UI for a long period of time.
That should be something that can happen within half a second or second.
So it's it's best if the user can't even read whatever text here.
So that's how short these dialogues should be.
This progress dialogues in the context of dialogues.
I can highly recommend to check out the documentation here and especially guides, because you can see
there are a bunch of guides here.
And one of them is for dialogue.
So if you want to know more about how to create a custom dialogue, this is the place to go.
Because here you have a bunch of code examples of layout examples, which I really like.
And yeah, you have the Scotland code.
You directly so you can copy it and use it for yourself can see how you can positive, negative and
neutral buttons and kind of lists and so forth.
So a bunch of options, pretty cool stuff.
You can design it as you like and here is the documentation that can really help you out.
And of course, it's not the only thing that you can find here not only dialogues, but you can find
guides here on a lot of different topics.
Some are better than others.
And yeah, I would definitely recommend to check out the documentation every now and then in order to
get a better understanding of what is going on.
Something that I really like is, for example.
Drag and drop because drag and drop is a cool feature and apps, and it feels good.
So you could, of course, check out the documentation on that.
Even though we're not using drag and drop in our applications yet, but that's not to hold you back
because it's really your own experience.
You should make this course your very own experience, and part of it is to learn stuff around the course
and not just the core stuff itself.
Because of course, content itself is great, and I really put a lot of effort into creating a great
course.
But of course, I cannot cover everything, and that's not even necessary because there are a bunch
of guides which are amazing here in the documentation.
All right, so I'd say that's enough for now.
Good luck with the guides that you find here.
If you find something super duper useful and you want to share it, of course, please share it with
the other students.
And yes, you in the next video.