Question

J'ai un tabhost avec 2 onglets dans mon activité principale, pour le 2ème onglet, j'ai ajouté une intention de vue de liste comme du contenu. Tout fonctionne bien. Maintenant, j'ai remplacé onCreateDialog() Méthode dans la vue de la liste (2ème onglet), lorsque j'ai appelé showDialog(MY_DIALOG); méthode onCreateDialog() s'appelle mais je reçois un avertissement dans le logcat comme

"WARN/InputManagerService(58): Window already focused, ignoring 
focus gain of:  com.android.internal.view.IInputMethodClient$Stub$Proxy@44ee6948"

Quelqu'un peut-il m'aider à afficher la boîte de dialogue dans l'activité de Tabhost.

//Éditer

protected Dialog onCreateDialog(int id) {
Log.v(Constants.LOGTAG, " " +CLASSTAG+ " onCreateDialog(): +++ START +++");
AlertDialog.Builder builder = new AlertDialog.Builder(this);        
switch (id) {
    case DIALOG_MY_TYPES: {
        Log.v(Constants.LOGTAG, " " +CLASSTAG+ " onCreateDialog(): DIALOG_MY_TYPES");
        CharSequence[] items = {"option1", "option2", "option3"};
        builder.setTitle("Select").setItems(items,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                    Log.d(CLASSTAG, "item selected = " + item);
                    dialog.cancel();
                }
            }).setNegativeButton("Cancel",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    Log.d(Constants.LOGTAG, " "+CLASSTAG+" Cancel button is clicked");
                    dialog.cancel();
                }
            }); 
    }

}//switch
alert = builder.create();
Log.v(Constants.LOGTAG, " " +CLASSTAG+ " onCreateDialog(): +++ END +++");
return super.onCreateDialog(id);                
}

Merci d'avance. -Nehatha

Était-ce utile?

La solution

Changer return super.onCreateDialog(id); à return alert;. Je suppose qu'une autre partie de votre activité appelle ShowDialog (int). Sinon, vous voudrez soit le faire, soit appeler la méthode Show dans la boîte de dialogue retournée de OnCreateDialog (ID).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top