Ho un gestore che è un TextWatcher
e non so come ottenere il View
che ha cambiato il testo.Come ottenere la vista nel contesto del metodo TextWatcher?
Ecco il mio gestore:
TextWatcher handler = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
oldText = s.toString();
}
@Override
public void afterTextChanged(Editable s) {
//v.setText("afterTextChanged");
}
};
Nota la parte commentato, che è quello che voglio, per ottenere il View
dal EditText
che ha innescato l'evento, per modificare il testo dopo che il testo è stato modificato.
Come posso raggiungere questo metodo .setText()
all'interno dell'evento afterTextChanged? (Come evento onClick che vista è v
)
classe TW implementa TextWatcher {public TW (Visualizza v) {... – pskink
Non riesco a capire che. Ma ho l '"idea", puoi pubblicare una risposta contenente una classe di esempio che posso implementare contenente questo 'View v'? –