Hey there.
So we will enter information about then you visit up of our club.
And next we will need to store this data in all our data the database.
Therefore we first need to extract all this data.
There are no problems with the text.
We can extract the text that is inserted here easily but with the subpoena we need to set some kind
of numerical value for each of the options so that we can then put this value in our database and retrieve
it from this database.
And so by these value said the agenda of our visitor that just we now need to create logic for assigning
a value to all variable in gender dependent on what is selected in the spinner.
Let's do it.
For this we in our agenda subpoena well said set on item selected listener.
And here in New adopt a view on items selected listener.
Let me call ups the step for better view.
This code over the anonymous class on item selected listener is placed here and we need to implement
the behavior order to method methods on items selected and on not and selected in it when an element
is selected or when nothing is selected.
What we will do in these two cases to do this list first in the on item selected method they're a great
variable of the type string and name it selected gender.
For example
and assign the next value these parameter parent specify get item at position.
And here we specify the parameter position we passed.
Here we emphasize incompatible thoughts because this method returns an object.
But since we know that we have the string value unknown male and female strings Therefore here we can
with a clear conscience only cost to the type string clustering.
And further we will use selected gender string to determine what assigned to our gender variable.
Well let's first check Eve then we can use the text you utilize glass.
There is such a class in that door.
And we can check with this class whether our low string is empty and put Senate agenda that that is
if the string is empty then this method returns true.
Therefore we need the opposite case when it is not empty.
Therefore we will indicate here exclamation side which means not if string is not empty.
Then we will assign next let's check if selected get gender equals male.
Then gender we assign one value else
selected gender equals female
then gender assigned to
males in another.
Any case will have unknown option so we can not check if we kind right gender to set zero and also in
the or not and selected method if nothing selected we will assign gender zero by default.
So we figured out another point we need to somehow save use of data.
We can place a bottom here by clicking on which we save the data but we may also need sometimes to delete
some user.
Therefore we need two buttons.
Save user and delete user but we can do this not using buttons but using the menu at menu well its menu
in this activity and in the race create a new resource directory select the menu here as we already
did click okay and here is new in your source file
example name it as man bar menu or lets us.
We will not only add but also delete.
Let's call it edit Man by menu click Okay.
Next we create here.
Item
to specify I.D. say Mama.
Well let's name it safe and mambo follow club next title save member
next in the specify some kind of icon for this as you remember we need to put it in the drawer Bill
folder
let's look for save here.
Select this icon click Okay next and finish
yes.
And it was necessary to rename it immediately.
Let's rename now refactor it name because we because what.
Well it's right here.
Want to make everything Ft.
And another icon
delete icon.
This one again immediately picks.
Well that's right.
White next and finish.
And here we can specify.
Now I icon drivable say and show section let's do always so that this option is always reasonable on
the panel let's call it and add another item.
Call it delete Mamba here also.
Select another icon
and we will probably hide this option.
So thus it appears only when we click on the dots in the menu.
So we created it allowed for menu and now we can in the ad man activity press cancel all and select
on create options menu.
And here we are right.
Get menu inflator.
Inflate.
Next we'll get our all out wish recreate it and pass the these parameter menu.
Return true
and another method that we must override again press control.
Oh and on options
item selected
here we switch using the switch operator.
According to all item which is passed here.
Item get item I.D. and then right case are I.D. save member we will return for now.
Just true.
Next we will change this.
When we implement our database the next case are I.D..
Delete member
again.
Return true
next.
Another case Android
I.D. home
now deals
navigate from same task.
These and again return to
so let's run the app.
We got a menu icon Save icon is constantly on our panel and here we can delete member and in the next
video we will take up the implementation over the database in our Olympus club application.