Code example for Editable

Methods: toString

0
 
        EditText t = (EditText) findViewById(R.id.numsongs);
        t.addTextChangedListener(new TextWatcher() {
 
            public void afterTextChanged(Editable s) {
                String text = s.toString();
                try { 
                    mNumToInsert = Integer.valueOf(text);
                } catch (NumberFormatException ex) {
                    mNumToInsert = 20;
                } 
                setInsertButtonText(); 
            } 
 
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            } 
 
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            } 
 
        });