Android EditText and addTextChangedListener
        Posted  
        
            by 
                Alex
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Alex
        
        
        
        Published on 2011-02-21T10:41:31Z
        Indexed on 
            2011/11/13
            17:51 UTC
        
        
        Read the original article
        Hit count: 359
        
android
im currently porting a database manager to android and due to performance reasons i like to update only propertys that have been modified. Im trying to do this with the addTextChangedListener in order to add modified entrys to a List, but my Program never enters any of its methods.
EditText Et = (EditText) Editors.get(Prop.Name);
Et.addTextChangedListener(new TextWatcher() {
    @Override
    public void afterTextChanged(Editable s) {
        // TODO Auto-generated method stub
    }
    @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
        if(Prop.GetType() == Property.PROPTYPE.num) {
            float f = Float.parseFloat(s.toString());
            Prop.FromString(f);
        }
        else {
            Prop.FromString(s.toString());
        }
        propertiesToUpdate.add(Prop);
});
Et.setText(Prop.ToString());
© Stack Overflow or respective owner