@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    sendRequest = getIntent().getParcelableExtra(SendRequest.SEND_REQUEST_KEY);

    Object retained = getLastNonConfigurationInstance();
    if (retained instanceof AbstractSendAsyncTask) {
      asyncTask = (AbstractSendAsyncTask) retained;
      asyncTask.setActivity(this);
    } else {
      asyncTask = createAsyncTask();
      asyncTask.execute();
    }
  }
 @Override
 public Object onRetainNonConfigurationInstance() {
   asyncTask.setActivity(null);
   return asyncTask;
 }