1

friends,

i want to restrict " character in android EditText any one guide me how to achieve this in java code?

Select0r
  • 12,234
  • 11
  • 45
  • 68
UMAR-MOBITSOLUTIONS
  • 77,236
  • 95
  • 209
  • 278

4 Answers4

1

You probably want to set an InputFilter on your EditText object

This page has an example of an InputFilter for numeric values

tim_yates
  • 167,322
  • 27
  • 342
  • 338
1
((EditText)findViewById(R.id.EditText01)).addTextChangedListener(new TextWatcher() 
 {           
public void beforeTextChanged(CharSequence s, int start, int count, int after) 
{             
                    //check here if character is '"' if yes don't allow to right
}          
public void onTextChanged(CharSequence s, int start, int before,  int count) 
{            

}            
@Override        
 public void afterTextChanged(Editable s)
 {             
    // TODO Auto-generated method stub         
 }     
});
Vivek
  • 4,170
  • 6
  • 36
  • 50
0

May this solve it?
How to restrict special characters from an Android EditText field?

Community
  • 1
  • 1
Select0r
  • 12,234
  • 11
  • 45
  • 68
0

use the onKeyDown or onTextChanged event

Tobias
  • 7,282
  • 6
  • 63
  • 85