以下是我的问题:
我知道如何发送短信,但我在循环like this中使用它,我知道发送短信不好,所以我' d喜欢添加延迟(即1000毫秒)。但是如何?
我想使用ProgressDialog来显示发送短信的进度。我知道我已经为此使用了Thread或AsyncTask。但我找不到工作代码......
目前,我使用的代码并非如此:
Button sendButton = (Button) findViewById(R.id.sendButton);
sendButton.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
if (!studentList.isEmpty()) {
for (int i = 0; i < studentList.size(); i++) {
Student currentStudent = studentList.get(i);
currentStudent.sendSMS();
}
} else {
Toast.makeText(getApplicationContext(), "The list is empty.", Toast.LENGTH_SHORT).show();
}
}
});
如果您需要更多信息,请不要犹豫
我希望有类似工作示例代码的东西......
我是Java和Android开发的初学者,记住开始有多困难,请放纵!
此致 Drarig29。