Here are my problems :
I know how to send SMS, but i'm using it in a loop like this, and I know that it's not good to send SMS, so I'd like to add a delay (i.e. 1000 milliseconds). But how ?
I'd like to use a ProgressDialog to show the progress of sending SMS. I know that I've to use a Thread or an AsyncTask for this. But I don't find working code...
For the moment, I've this code, which doesn't really work :
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();
}
}
});
If you need more information, do not hesitate.
I'd like to have something like a working sample code...
I am a beginner in Java and Android development, remember how difficult it was to start, please be indulgent !
Regards, Drarig29.