0

メインアクティビティ内に2つのタブがあるタブホストがあります。2番目のタブには、コンテンツとしてリストビューインテントを追加しました。すべてが正常に機能しています。onCreateDialog()リストビュー(2番目のタブ)でメソッドをオーバーライドしました。showDialog(MY_DIALOG);メソッドを呼び出すと呼び出されonCreateDialog()ますが、LogCatで次のような警告が表示されます。

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

tabhostのアクティビティ内にダイアログボックスを表示する方法を教えてもらえますか。

//編集

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);                
}

前もって感謝します。-ネハサ

4

1 に答える 1

0

に変更return super.onCreateDialog(id);return alert;ます。あなたのアクティビティの他の部分がshowDialog(int)を呼び出していると思います。そうでない場合は、そうするか、onCreateDialog(id)から返されたダイアログでshowメソッドを呼び出します。

于 2011-05-16T16:53:52.077 に答える