I have an activity that contains the cardview of the image at the end of the question that has 3 edittext. I wanted to know how I can do that when I click on any button, a new cardview with the same layout is added again, so I can retrieve your data. I tried to follow the other question , but I did not succeed.
ThecardviewisinsideanotherRelativeLayoutanditslayoutisasfollows:
<android.support.v7.widget.CardViewandroid:id="@+id/infoContato"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/infoCadastro"
android:layout_marginTop="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp">
<RelativeLayout
android:id="@+id/tituloInfoContato"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/imageViewIcTelefone"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:contentDescription="@string/dicaTelefone"
android:src="@drawable/ic_phone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_toEndOf="@+id/imageViewIcTelefone"
android:layout_toRightOf="@+id/imageViewIcTelefone"
android:text="@string/lblInfoContato"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
<!-- Telefone -->
<android.support.design.widget.TextInputLayout
android:id="@+id/txtInputAddCadastroTelefone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tituloInfoContato">
<EditText
android:id="@+id/edtaddTelefone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/dicaTelefone"
android:inputType="phone"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<!-- Celular -->
<android.support.design.widget.TextInputLayout
android:id="@+id/txtInputAddCadastroCelular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtInputAddCadastroTelefone">
<EditText
android:id="@+id/edtaddCelular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/dicaCelular"
android:inputType="phone"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<!-- Email -->
<android.support.design.widget.TextInputLayout
android:id="@+id/txtInputAddEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtInputAddCadastroCelular">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAllCaps="true"
android:hint="@string/Email"
android:inputType="textEmailAddress"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>