[英]How to start progress dialog on button click of alert dialog in android?
我想單擊“警報對話框”的“是”按鈕來啟動進度對話框。 但是當我運行它時。 它給了我一個警告,警告Window已聚焦,而忽略了聚焦增益。 它有時有效,有時發出警告。 並且進度對話框不會啟動。 請提供一些建議
例如 -
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog.Builder ab = new AlertDialog.Builder(this);
ab.setMessage("Choose Yes/No :");
ab.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
arg0.dismiss();
ProgressDialog pd = new ProgressDialog(PDActivity.this);
pd.setMessage("test");
pd.show();
pd.setCancelable(true);
}
});
ab.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
ab.show();
}
像上面一樣嘗試..
在啟動進度對話框之前關閉警報對話框。
單擊是按鈕時,先關閉警報對話框,然后啟動進度對話框。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.