List<PhoneGis> list = dbService.findAll();
if (list.size() != 0) {
//简介写法
mTextView.setText("发送开始...");
progressdialog = ProgressDialog.show(BeginInspection.this, "请稍等片刻...", "开始发送据...");
// 让ProgressDialog显示
progressdialog.show();
}
PhoneGis p;
for (int i = 0; i < list.size(); i++) {
p = list.get(i);
String content ="userphone=" + p.getUserphone() + "&imei=" + imei +
"×tamp=" + p.getTimestamp();
if (i == list.size()-1) {
progressdialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mTextView.setText("发送结束...");
Toast.makeText(getApplicationContext(), "发送结束...", Toast.LENGTH_SHORT).show();
}
});
}
if (sendDate(content)) {
progressdialog.dismiss();
dbService.delete(p.getId());
System.out.println("时间====" + p.getTimestamp());
}
}
代码如上
为什么点击按钮 不能显示progressdialog = ProgressDialog.show(BeginInspection.this, "请稍等片刻...", "开始发送据...");这个toast 而是 等循环体结束后才显示 然后在继续显示 结束
如果要想实现 点击按钮 显示toast 开始发送数据 然后循环结束后显示 toast 发送结束 该怎么实现呢???