我刚刚定义了一个对话框作为android网站建议,但它没有显示按钮点击,一些代码scracht(我没有得到任何错误): static final int DIALOG_A = 1; static final int DIALOG_B = 2; TextView textX;
protected Dialog onCreateDialog(int id, String text) {
Dialog dialog = new Dialog(this);
dialog.setContentView(decrytedText);
Log.v("DialogTest", " onCreateDialog(): +++ START +++");
switch(id)
{
case DIALOG_A:
dialog.setTitle(this.getString(R.string.dialog_title_wrong_key));
break;
case DIALOG_B:
dialog.setTitle(this.getString(R.string.dialog_title_ok_key));
break;
}
return dialog;
}
somebutton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
Object butts[] = (Object []) v.getTag();
try
{
Log.v("DialogTest", " try");
String decrypted ="OK GO";
textX.setText(decrypted);
showDialog(DIALOG_A);
}
catch (Exception e)
{
Log.v("DialogTest", "catch");
textX.setText(R.string.dialog_no_wrong_key);
showDialog(DIALOG_B);
}
}
});