我想显示从另一个对话框中的一个按钮的onclick听众的对话,但第二个对话框不会显示。我搜索,发现类似problem- 对话框秩序的Android ,试图解决方案提供,但即使这是行不通的。
I am trying to display a dialog from the onClick listener of a button of another dialog, but the 2nd dialog won't display. I searched and found a similar problem- Dialogs order in Android, tried the solution provided, but even that does not work.
我code是非常类似于在回答中提供的
My code is very similar to the one provided in the answer.
公共无效的onClick(DialogInterface 对话框,INT ID){ 的ShowDialog(SECOND_DIALOG); dialog.dismiss(); }
public void onClick(DialogInterface dialog, int id) { showDialog(SECOND_DIALOG); dialog.dismiss(); }
任何帮助将是非常美联社preciated。
any help will be really appreciated.
谢谢
阿克沙伊
推荐答案
这是我怎么做的:
if (!appPrefs.getAcceptedUsageAggrement()) {
tracker.trackPageView("/UsageAgreementDialog");
acceptedUsage_alertDialog = new AlertDialog.Builder(BroadcastSMSActivity.this)
.setTitle(R.string.accept_usage_title)
.setMessage(R.string.accept_usage_message)
.setNegativeButton(android.R.string.cancel, new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setPositiveButton(android.R.string.ok, new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (appPrefs.getAppVer().equals("")) {
tracker.trackEvent("Application", "Install", getAppVerName(), 1);
} else {
tracker.trackEvent("Application", "Upgrade", appPrefs.getAppVer().toString()+"->"+getAppVerName(), 1);
}
displayRecentChanges = true;
appPrefs.saveAppVer(getAppVerName());
appPrefs.saveAcceptedUsageAggrement(true);
// Display Recent Changes on 1st use of new version
if (displayRecentChanges) {
tracker.trackPageView("/RecentChangesDialog");
recentChanges_alertDialog = new AlertDialog.Builder(BroadcastSMSActivity.this)
.setTitle(getString(R.string.changes_title, getAppVerName()))
.setMessage(R.string.changes_dialog)
.setPositiveButton(android.R.string.ok, new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
recentChanges_alertDialog.cancel();
acceptedUsage_alertDialog.cancel();
}
})
.create();
recentChanges_alertDialog.show();
}
}
})
.create();
acceptedUsage_alertDialog.show();
}
相关推荐
最新文章