‫Welcome back.
‫In this video, we'll design the Add new contact activity.
‫But before we move to this new activity, I should add a contact array list, dot clear code, because
‫every time without this line, every time I run the application or add the new contacts, there is a
‫duplication of items.
‫So if my database contains five items, if I add one there should be six items.
‫But without this code, without clearing the array list, the array list will add five plus five plus
‫one.
‫So it will display 11 items.
‫This is a very important concept.
‫I should mention it.
‫You need to clear the array list that it is created as a local variable and should be cleared every
‫time the data change.
‫Now let's move to add a new contact activity and open the XML file.
‫Here I'll create two edit texts, one for the email and one for the name and one button.
‫Just to submit the additions.
‫I'll move this layout tag to here and this constraint layout would be included.
‫Also, the namespaces are moved and here we go.
‫This is our constraint layout.
‫I'll add to edit text and one button.
‫Infer the constraints and drag and drop it to here.
‫Then I'll add another edit text wrap or matchparent.
‫Drag and drop it to here and infer the constraints.
‫Then I'll add another widget, which is a button.
‫And the drag and drop it there to here and infer the constraints.
‫And this is our layout for add new contact activity.
‫Then I need to add a background for this layout.
‫I'll copy this background image and add it to the resource folder drawable folder.
‫The constraint background equal to drawable.
‫Also, I need to change the colors for these edit tags.
‫Copy these attributes and paste it here in the edit text.
‫As mentioned before, we need to use the data binding in our layouts.
‫So here I'll create data variables one for the handler for the click event and one as a contact variable.
‫Here.
‫I'll start with data variable contact.
‫It's of type Campmaster, master coding dot contacts object and the other variable named as click handler.