1

I am new at android programming and I am working on a project to get familiar with its environment. I am going to have a popup window and in this window there would be an input. I need this input to only accept int's.

Sameera Thilakasiri
  • 9,452
  • 10
  • 51
  • 86
user642206
  • 149
  • 1
  • 8

3 Answers3

4

You should check that stackoverflow thread: AlertDialog Input Text

And then try to use something like this:

//EditText input;
input.setInputType(InputType.TYPE_NUMBER_VARIATION_NORMAL);

You have an example here: http://www.youtube.com/watch?v=_joTj5XTwuQ And the Android documentation here: http://developer.android.com/reference/android/text/InputType.html

Community
  • 1
  • 1
Micaël Félix
  • 2,697
  • 5
  • 34
  • 46
0

Check the apidemos AlertDialogs. Set the inputtype of the Textview TYPE_CLASS_NUMBER . That should do it.

nandeesh
  • 24,740
  • 6
  • 69
  • 79
0

here you go

1) Create a layout in your res/layout folder, which should include all views which you want to show as popup.

2) create an activity which should show this layout in setcontentview method.

3) in manifest file , Activity declaration for above activity put this

  android:theme="@android:style/Theme.Dialog"

tag,
4) start this activity from where you want a popup window, above tag make your activity as popup/dialog, instead of full screen layout.

you can do it by adding custom view in dialog too, but above solution will give more command on screen, and you can add more views on it..

AAnkit
  • 27,299
  • 12
  • 60
  • 71