我有一个tabhost在我的主要活动中有2个选项卡,对于第二个选项卡,我添加了一个列表视图意图作为内容。 一切工作正常。 现在我已经重写onCreateDialog()
方法列表视图(第二选项卡的),当我做出showDialog(MY_DIALOG);
方法onCreateDialog()
调用获取调用,但我得到一个警告,在logcat的像在选项卡式活动内showDialog问题
"WARN/InputManagerService(58): Window already focused, ignoring
focus gain of: [email protected]"
任何人可以帮助我如何在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);
}
感谢。 -Nehatha
你可以显示'onCreateDialog'方法的代码。 – 2011-05-16 16:16:50
@Tanmay,用代码 – 2011-05-16 16:40:52