I have an EditText in an AlertDialog, but when it pops up, I have to click on the text box before the keyboard pops up. This EditText is declared in the XML layout as "number", so when the EditText is clicked, a numeric keypad pops up. I want to eliminate this extra tap and have the numeric keypad pop up when the AlertDialog is loaded.
All of the other solutions I found involve using
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
This is NOT an acceptable solution, as this results in the standard keyboard rather than the numeric keyboard popping up. Does anyone have a way to make the numeric keyboard pop up in an AlertDialog, preferably while keeping my layout defined in XML?
AlertDialog dialog = new AlertDialog.Builder(this)
    .setTitle("Mark Runs")
    .setView(markRunsView)
    .setPositiveButton("OK", new DialogInterface.OnClickListener() {                        
        @Override
        public void onClick(DialogInterface dialog, int which) {
            EditText runs = (EditText)markRunsView.findViewById(R.id.runs_marked);
            int numRuns = Integer.parseInt(runs.getText().toString());
         // ...
        })
    .setNegativeButton("Cancel", null)
    .show();
Edit: I want to be perfectly clear that my layout already has:
android:inputType="number"
android:numeric="integer"
I also tried this:
//...
.setNegativeButton("Cancel", null)
.create();
EditText runs = (EditText)markRunsView.findViewById(R.id.runs_marked);
runs.setInputType(InputType.TYPE_CLASS_NUMBER);
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
dialog.show();
but that also did not work. With the setSoftInputMode line, I still get the full keyboard when the AlertDialog loads; without it, I still get nothing. In either case, tapping on the text box will bring up the numeric keypad.
Edit Again:
This is the XML for the EditText
<EditText
    android:id="@+id/runs_marked"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="4dip"
    android:inputType="number"
    android:numeric="integer">
    <requestFocus/>
</EditText>
 
     
     
     
     
    