Welcome back and this video, we are going to edit the card name here and put it into the edit text
and also we are going to add the delete button and I'd say, yeah, let's get started.
So the first thing is that I will need to use a new stream, which I'm just going to call delete card.
So here, string name.
Will be the lead card, which will then just say delete kaat.
All right, so that's News Stream that we will require and then I'm going to also create a new menu.
So it's going to be similar to the one where we had.
Menu members, actually, it's more like this one at members and I'm going to call this one menu delete
card.
All right, let's look at this lead card, so here we have an item in it and I'm going to give this.
And you ID I'm going to call this one delete card, so action delete card, then the category will stay
the same.
The text here should be our lead card text that we prepared, and it should also be shown as action
always because it's just one item.
And of course, I want to use a different vector here because it should be a delete vector.
So let's go ahead and create a new vector for this.
Therefore we can just search for the lead.
I think this one will be good enough for this.
So let's use this icon here.
And I'm going to call this one, I see Vector to lead 24.
There we are.
I see Victor delete.
24 DPE.
And for some reason, it doesn't take it, I see.
Underscore Victor Gilead, 24.
All right, that's the one.
OK, so this is the ICAM.
And the menu button.
Now I want to inflate that menu file, so this menu button, so to speak, and that should happen in
the card details activity because that's where it should be displayed here, right at the top right
corner instead of the menu.
So I need to add that there.
And in order to inflate it, I need to override a function in here which is on.
Create options menu.
This one here and there, I can go ahead and use the menu inflator.
To inflate our thought menu thought.
Many credit card.
I also need to pass in the menu itself, so here I'm going to person menu.
For now, we're not going to take care of the event that should happen once we click on it, but we
just want to display it on top of that.
What we want to display is also.
The edited text, so I'm just going to set the edit text card details, so this added text right here.
I want to populated with the same title as we have in the action bar.
All right.
So basically, it's the same thing.
So we can just.
Copy this whole part here.
And set that as text.
So it will be ambered details.
List at the top of the list position and the cards.
Name.
And as it seems, it doesn't like the property, so I'm just going to use to set text.
Function here to do pretty much the same thing, we just need to close it at the end and that seems
to work totally fine.
So for some reason, it doesn't like me to use the property name directly.
All right.
So the same goes for the selection.
So I will set the selection for my ETTY name card details.
Dots, text to string.
Total length.
What that allows me to do is to set the focus directly onto the ending of the length of the text, so
at the end of the text, pretty much.
So this when I click on it, you could see directly the focus goes over from the left hand side to the
right hand side.
So that's what I get with this line, said Selection's.
And then we can also do and that is really just necessary, and if you decided to take the same approach
that I do, is that you don't want to load the screen all the time when going back.
So only if the world changes made, for example, then you can, of course.
Also used to approach where you would refresh everything in the resume function, as we have covered
in the last video.
So what I'm going to do is I'm going to implement the activity for result approach.
So first of all, I need to have a new variable here in my companion object const.
Wild card details.
Request code, teachers request code, which will be an integer, and I'm going to assign 14 to it.
And now going back to the start, activity for result here.
Your card details, I can now go ahead and.
Not only start the activity, but actually started for a result.
And here, I'm just going to use the card details request code.
As the Unicode.
And then on activity result.
Here.
I will.
Make a small adjustment, so here, I don't only want to check the request code equals members.
Request code.
But alternatively, it should be the request code should be.
Card details.
Request cut.
All right, so in either case, I want to.
Pretty much go ahead and refresh the page.
So if the activity result, OK, is the result code and the request code is either member's request
or card details request code.
Which means that we either get back from this member's activity here and the word changes or we go back
from the card activity and we made changes in either case, I want to refresh this page.
Otherwise, I don't want to make any changes on this page or on this activity here.
All right, for now, let's just test it.
Let's keep this video super short so that we still have enough time for longer videos later on.
Well, we will, of course, implement the actual functionality behind it, because for now, the only
thing that we do is to display the car title name and also display the icon at the top right corner.
So let's see.
Board with image, let's click on random name, we can see it's edited or it's added in here, it's
populated and we have this delete button as well.
All right.
So that is it for this video.
In the next video, we're going to add some more steps here, which will then allow us to, of course,
delete it and also some other settings.
So you in the next video.