SendCaptchaAsyncTask.java :  » SMS » smsforfree » it » rainbowbreeze » smsforfree » logic » Android Open Source

Android Open Source » SMS » smsforfree 
smsforfree » it » rainbowbreeze » smsforfree » logic » SendCaptchaAsyncTask.java
package it.rainbowbreeze.smsforfree.logic;

import it.rainbowbreeze.smsforfree.common.ISendCaptchaActivity;
import it.rainbowbreeze.smsforfree.common.ResultOperation;
import it.rainbowbreeze.smsforfree.domain.SmsProvider;
import android.content.Context;


/**
 * Send a captcha
 */
public class SendCaptchaAsyncTask
  extends ProgressDialogAsyncTask<ISendCaptchaActivity>
{

  //---------- Ctors
  public SendCaptchaAsyncTask(
      Context context,
      ISendCaptchaActivity callerActivity,
      String progressTitle,
      SmsProvider provider)
  {
    super(context, callerActivity, progressTitle);
    mProvider = provider;
  }




  //---------- Private fields
  private SmsProvider mProvider;




  //---------- Private methods
  protected ResultOperation doInBackground(String... params)
  {
    //params.length must be equals to 2
      
    String providerReply = params[0];
    String captchaCode = params[1];
    
    return mProvider.sendCaptcha(providerReply, captchaCode);
  }
  
  @Override
  protected void onPostExecute(ResultOperation result) {
    //close progress dialog
    super.onPostExecute(result);
    //and pass the control to caller activity with the result
    mCallerActivity.sendCaptchaComplete(result);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.