Search code examples
androidvalidationsearch-dialog

Android Search Dialog how do I restrict input to numbers only?


I'm building a zip code search page for my Android app so I want to force the user to enter 5 numeric digits. I've searched everywhere and I don't see any way to for the Search Dialog. I know that text entry fields can be set to a numeric type, how do I do that for the Search Dialog?


Solution

  • You can use Searchable Configuration

    In That you can Specify

    android:inputType="inputType"
    android:imeOptions="imeOptions"
    

    For more information

    http://developer.android.com/guide/topics/search/searchable-config.html