You should show your progress bar in :
SendRequestExample.onPreExecute()
and hide it in:
SendRequestExample.onPostExecute()
methods.
If your SendRequestExample is universal for many activities, then you can make MyActivity implement interface, ie:
interface ProgressBarAware {
void showProgressbar();
void hideProgressbar();
}
and pass ProgressBarAware reference to your AsyncTask. Its important to update this reference in AsyncTask during configuration changes, that means every time your Activity.onCreate executes after config change.
One more: dont use get() on asynctask on UI thread, in call 'new SendRequest().execute().get();'. This causes lots of problems. It block message queue that is used by Android to process messages responsible for reacting to user clicks, drawing widgets, and lots more. After few minutes, such UI thread blocking will end up in ANR (Application Is Not Responding), and system will terminate your app.