3
I have the following code that creates 4 Edittext in Layout:
LinearLayout myLayout = (LinearLayout) findViewById(R.id.formulario);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
EditText[] pairs=new EditText[4];
for(int l=0; l<4; l++)
{
pairs[l] = new EditText(this);
pairs[l].setTextSize(15);
pairs[l].setLayoutParams(lp);
pairs[l].setId(l);
pairs[l].setText((l + 1) + ": something");
myLayout.addView(pairs[l]);
}
How do I redeem the values of each field?
If I understand the question it will be so
pairs[0].getText().toString()
– ramaral
OK @ramaral, but this from the code I posted? the
new EditText()
serves to redeem values too? vc can be more specific?– Emerson Barcellos
Based on what you posted I can’t be more specific. I’m not even sure if that’s what you want.
– ramaral
Now even more confused I got "the new Edittext() serves to redeem values too?" What do you mean by "redeem"?
– ramaral
@ramaral code I posted creates 4 Edittext type fields. When I say I want to redeem values, I’m saying I want to take what was typed in each field.
– Emerson Barcellos