I want to store the input from the user in the EditText boxes and store them as a string so I can access it.
I used
nameIn = name.toString();
Log.i(null, nameIn);
(Think thats how you do it and it works fine) but when I use the same code in my int, it won't work.. Now how do I write it so that it can get the users input and store it in my int variable?
This is my code:
TextView nameText = (TextView) findViewById(R.id.nameText);
TextView numberText = (TextView) findViewById(R.id.numberText);
EditText nameInput = (EditText) findViewById(R.id.nameInput);
EditText numberInput = (EditText) findViewById(R.id.numberInput);
nameInput.addTextChangedListener(new TextWatcher(){
@Override
public void afterTextChanged(Editable name) {
nameIn = name.toString();
Log.i(null, nameIn);
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1,
int arg2, int arg3) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub
}
});
numberInput.addTextChangedListener(new TextWatcher(){
@Override
public void afterTextChanged(Editable number) {
//this bit im stuck storing the inputted text to an int
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
// TODO Auto-generated method stub
}});