Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid java EditText to int
    primarykey
    data
    text
    <p>I want to store the input from the user in the EditText boxes and store them as a string so I can access it.</p> <p>I used </p> <pre><code> nameIn = name.toString(); Log.i(null, nameIn); </code></pre> <p>(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?</p> <p>This is my code:</p> <pre><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 }}); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload