I need the value of inflated editText, I am inflating the design layout which is the child layout and MainActivity
is a parent layout.
below is the MainActivity class
public class MainActivity extends AppCompatActivity {
View array[];
String text;
LinearLayout container;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText edittext1 = (EditText) findViewById(R.id.email);
for (int i = 0; i < 4; i++) {
LinearLayout myLayout = (LinearLayout) findViewById(R.id.linearlayout);
View v = getLayoutInflater().inflate(R.layout.design, myLayout, false);
myLayout.addView(v);
int id = View.generateViewId();
v.setId(id);
EditText edittext = (EditText) v.findViewById(R.id.edittext);
text = edittext.getText().toString();
}
edittext1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplication(), "" + text, Toast.LENGTH_SHORT).show();
}
});
}
}