0
我需要在android.I中显示'n'
自定义对话框在while循环之外创建对话框并在循环内设置消息。我需要根据循环显示具有不同消息的对话框。但它显示dialog.show()行中的android.view.WindowLeaked异常。任何人都可以帮助我解决我的问题。不能显示多个对话框
我的代码是这样的:
//notif_count is the row count
if(notif_count>0)
{
dialog = new Dialog[notif_count];
for(ct=0;ct<notif_count;ct++)
{
dialog[ct] = new Dialog(this);
dialog[ct].requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog[ct].setContentView(R.layout.custom_dialog_alert);
}
cursor.moveToFirst();
ct = 0;
do
{
dec_name =cursor.getString(cursor.getColumnIndex(Database_Handler.name));
TextView tv_alert = (TextView)dialog[ct].findViewById(R.id.txt_alert);
tv_alert.setText(dec_name);
Button yes = (Button) dialog[ct].findViewById(R.id.btn_yes);
Button no = (Button) dialog[ct].findViewById(R.id.btn_no);
yes.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(donateurl));
startActivity(intent);
ct--;
dialog[ct].dismiss();
cursor.close();
sqldb.close();
finish();
}
});
no.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
ct--;
dialog[ct].dismiss();
cursor.close();
sqldb.close();
finish();
}
});
dialog[ct].show();
ct ++;
}while(cursor.moveToNext());
}
当异常显示的对话框? – 2013-03-02 08:06:29
@NAYOSO它显示在对话框 – Techy 2013-03-02 08:07:28
的显示()中,如果可能的话发布日志 – 2013-03-02 08:09:55