我的主要活动中有一个带有 2 个选项卡的 tabhost,对于第二个选项卡,我添加了一个列表视图意图作为内容。一切正常。现在我onCreateDialog()
在列表视图(第二个选项卡)中覆盖了方法,当我调用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);
}
提前致谢。-内哈达