I have added 3 EditTexts and one Button using layout inflater
Below is my java code:
mAddButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (!et_boiler_make_boiler_row.getText().toString().equalsIgnoreCase("")) {
onAddNewClicked();
buttonRemove.setVisibility(View.VISIBLE);
} else {
Toast.makeText(ConsumerCompanyProfileDetails4.this, "Can not add more rows. :(",
Toast.LENGTH_SHORT).show();
}
}
});
private void onAddNewClicked() {
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View addView = layoutInflater.inflate(R.layout.boiler_row, null);
buttonRemove = (ImageView) addView.findViewById(R.id.remove);
et_boiler_make_boiler_row = (EditText) addView.findViewById(R.id.et_boiler_make_boiler_row);
et_capacity_boiler_row = (EditText) addView.findViewById(R.id.et_capacity_boiler_row);
et_estd_year_boiler_row = (EditText) addView.findViewById(R.id.et_estd_year_boiler_row);
buttonRemove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((LinearLayout) addView.getParent()).removeView(addView);
}
});
mContainerView.addView(addView);
}
Now i want to check whether all the 3 EditTexts have some value or not before adding a new row. i.e. I want to add validations for EditTexts which is added dynamically before adding a new row.
And also i want to know how to get the values from added EditTexts.
Please help !