add_to.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TextUtils.isEmpty(personal_account.getText().toString()) && !TextUtils.isEmpty(surname_child.getText().toString()) && !TextUtils.isEmpty(name_child.getText().toString()) &&
!TextUtils.isEmpty(patronymic_child.getText().toString())) {
TableLayout tableLayout = (TableLayout) findViewById(R.id.table_children);
LayoutInflater inflater = LayoutInflater.from(MainActivity.this);
TableRow tr = (TableRow) inflater.inflate(R.layout.table_row_plus, null);
number = (TextView) tr.findViewById(R.id.number);
//для нумерации строк
int aInt = count++;
String aString = Integer.toString(aInt);
number.setText(aString);
fio_child = (TextView) tr.findViewById(R.id.fio_child);
String tv1 = surname_child.getText().toString();
String tv2 = name_child.getText().toString();
String tv3 = patronymic_child.getText().toString();
Value1 = tv1 + " " + tv2 + " " + tv3;
fio_child.setText(Value1);
number_lc = (TextView) tr.findViewById(R.id.number_lc);
String tv4 = personal_account.getText().toString();
number_lc.setText(tv4);
ImageView markOfTheRow = tr.findViewById(R.id.mark);
markOfTheRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tableLayout.removeView(tr);
Toast.makeText(getApplicationContext(), "Строчка удалена", Toast.LENGTH_SHORT).show();
}
});
tableLayout.addView(tr);
dialog.dismiss();
Toast.makeText(getApplicationContext(), "Ребенок добавлен", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Заполните все поля", Toast.LENGTH_SHORT).show();
}
}
});