The next thing we need to build is this button here, the functionality of it, so as you can see,
once I click on it, it asks me if I want to allow this app to access photos and media on the device.
And if I deny you can see I get the people up here saying, oops, you just denied permission.
Or if I allow it, then permission was granted.
Now you can read the storage files.
So this is how far we want to get first before we then actually select the image and then put it as
the background of our drawing for you.
All right.
So let's first of all, start with the UI and then see how it goes.
So the first thing we need to figure out is how to add another button to our.
Image button here at the bottom, so you can see we have this image button, which is our brush image,
so that's our current version.
Of course, we could just go ahead and add another image button in here, but we need to be careful
with it because we want the image buttons to be next to each other.
So what I'm going to do is I'm going to add another linear layout in here.
So I'm just going to say let's add another linear layout and I'm going to use the width of my parents
because it should take the whole width and only take as much height as is required.
All right.
So this is going to be our linear layout.
And inside of this linear layout, that's where I want to have my image buttons.
So I'm going to start with the first image, but I'm going to put it in here and then we need to add
some more settings to our linear layout here.
So I'm going to give it an idea first.
So let's add an idea here.
I'm going to call this one L.L. Action on their square buttons.
So I'll standing for a linear layout and then we want to have some action buttons in there.
So I think the naming should be fine.
Then I want the buttons to be centered.
So I set the gravity to the center so the buttons will be next to each other, but centered the orientation.
How should the orientation be?
Should the buttons be on top of each other or next to each other?
Well, the two action buttons should be next to each other.
So I'm going to use horizontal here and then we need to be careful with this whole constraint thingy.
So I'm just going to use the constraint elements that we had for the image button before, because now
our linear layout is at the same position as our image button was before, but it takes over its place,
so to speak, and it just contains the image button and the other image button that we have.
All right.
So the width and hide can stay the same, the margin can stay the same.
Everything pretty much can stay the same for our image button.
But now we can add another image button just before it.
So it should be just left off it.
All right.
Now, of course, I need to change the ID and I'm going to change it to I.B. gallery.
And then.
The faith x y should stay the same, the content description can be changed, so this will be the calorie
image and then the source, of course, has to be changed as well.
So we can.
Just drag in another drawable, and maybe you've done that already, if you just dragged all the colors
in there or the images directly in there.
So I'm just going to drag this icy gallery into my drawable folder or paste it in there.
Once we have direct in the image for our gallery, we can, of course, use it as the source for our
image.
But so now we have to image buttons.
So once you do something like I have done so this approach where you had an image button or an element,
whatever element that was and it had an I.D. or it has an ID, and then you decide to put a container
around it, which does linear layout is.
So we put this container around it to now contain multiple elements.
Instead of just having one element there, then you also have to be careful at the points where you
positioned them, because here are linear layouts that we have here at the top.
You can see here I'm getting an error and that is just underneath the frame layout where all our paint
colors are now.
It's just that this I.B. brush is not correct anymore because I.B. brush now is within our linear layout.
So it's Cinta, so to speak, hidden.
So what we need to do is we need to use L.L. Action buttons now because the paint colors are on top
of the actual election buttons.
OK, so that's pretty much what we're saying here.
And now we can go ahead and test this on our device.
So there we are, you can see the two buttons are next to each other and they are both centered with
some space in between and there are just underneath the whole color buttons.
And of course, this image button doesn't do anything yet.
All right.
So because the whole part with permissions and all will be pretty time consuming and will be pretty
extensive because we need to do a lot of things that we haven't done yet, I would say that we do that
in the next video.
So let's make a break here and go to the next video.
So see you there.