Validation in android
<p>I need allow the user to Enter only number and period in android through code</p>

<p>please help me</p>

<pre><code>    InputFilter filter = new InputFilter() {      
        public CharSequence filter(CharSequence source, int start, int end,  Spanned dest, int dstart, int dend) {

            System.out.println("source " + source);
            System.out.println("dSta " + dstart);
            System.out.println("dEnd " + dend);
            System.out.println("Start " + start);
            System.out.println("End " + end);

             for (int i = 0; i &lt; source.length(); i++) {     
                 if (!Character.isDigit(source.charAt(i))) {
                        System.out.println("Character.isDigit(source.charAt(i))  " + Character.isDigit(source.charAt(i)));
                     return "";               
                     }
                /* if (!Character.isDefined('.')) {          
                     return "";               
                     } */      
                 }
             return null;

            }
        }; 
</code></pre>
