L'affichage du clavier virtuel lorsque AlertDialog.Constructeur de l'objet est ouvert

Mon code pour l'ouverture d'une boîte de dialogue d'entrée se lit comme suit:

final AlertDialog.Builder alert = new AlertDialog.Builder(this);  
alert.setTitle("Dialog Title");  
alert.setMessage("Request information");  
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.edittextautotextlayout, null);
final EditText inputBox = (EditText) textEntryView.findViewById(R.id.my_et_layout);
alert.setView(inputBox);

Cela fonctionne très bien sauf que j'ai à taper la ligne de saisie de texte avant de le clavier virtuel s'affiche.

Suivant l'avis donné ici j'ai essayé d'insérer:

inputBox.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus) {
            alert.getWindow().setSoftInputMode( 
               WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        }
    }
});

mais Eclipse objets qui "la méthode getWindow() n'est pas défini pour le type AlertDialog.Builder".

Il semble que la setOnFocusChangeListener code fonctionne pour un AlertDialog objet, mais pas un AlertDialog.Générateur de rapports. Comment dois-je modifier mon code pour le clavier apparaissent automatcially.

InformationsquelleAutor prepbgg | 2010-10-29