I'm trying to create an xml which gets me the text of the the editText field. Although it works but I am only getting the typed in text for only the last field. This is my code:
TextView textOut;
EditText getInput;
TextView textOut1;
EditText getInput1;
TextView textOut2;
EditText getInput2;
TextView textOut3;
EditText getInput3;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.account);
textOut = (TextView) findViewById(R.id.textView6);
getInput = (EditText) findViewById(R.id.editText1);
Button ok = (Button) findViewById(R.id.submit);
ok.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
textOut.setText(getInput.getText());
}
});
textOut1 = (TextView) findViewById(R.id.textView7);
getInput1 = (EditText) findViewById(R.id.editText2);
Button ok1 = (Button) findViewById(R.id.submit);
ok1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
textOut1.setText(getInput1.getText());
}
});
I'm trying to get the text for all the typed text fields. I have four field ( I have only shown two in the code)
Is there anyway in which I can get the typed in text for all the editText field?
Thank you.
Edit:
TextOut = (TextView) findViewById(R.id.textView6);
getInput = (EditText) findViewById(R.id.editText1);
textOut1 = (TextView) findViewById(R.id.textView7);
getInput1 = (EditText) findViewById(R.id.editText2);
Button ok = (Button) findViewById(R.id.submit);
ok.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
textOut.setText(getInput.getText());
}
});