I want an AsyncTask to send an SMS given the parameters. The SMS is being sent correctly, but I want to show a ProgressBar until the SMS is sent and then take the user to a new activity. I looked on the internet for examples, but I could not figure out what I want to do with my case. Below is my AsyncTask
public class sendSms extends AsyncTask<Void, Integer, Void>{
protected void onPreExecute() {
pb.setVisibility(View.VISIBLE); //pb is the ProgressBar
}
@Override
protected Void doInBackground(Void... params) {
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
return null;
}
protected void onProgressUpdate(Integer... progress){
//Not sure what to do here
}
protected void onPostExecute(){
Intent intn = new Intent(CurrentActivity.this, NewActivity.class);
startActivity(intn);
}
}
I appreciate any help. Thank you.
please check the source code.
}
I think it help you.
Thanks