title: Get the result from async task
body: <p>I want to get my result from an Async task. If I use task.execute.get, my UI will be frozen. I want my Async task will be stand alone class so I don't want to put my result processing code in onPostExecute. I've found some information about call back data from Async task here: <a href="http://blog.evoxmusic.fr/content/how-implement-callback-asynctask" rel="nofollow noreferrer">http://blog.evoxmusic.fr/content/how-implement-callback-asynctask</a><br>
  and here: <a href="https://stackoverflow.com/questions/9963691/android-asynctask-sending-callbacks-to-ui">android asynctask sending callbacks to ui</a><br>
  but the problem is:
  1-I don't know when to process the result?
  2-why to use interface?
  3-What's the differences of using an interface with simply putting the result in a public field in Async task from onPostExecute?</p>
  
  <p>This is my Async class:</p>
  
  <pre><code>public class AsyncCallWs extends AsyncTask&lt;String, Void, String&gt; {
  
      private ProgressDialog dialog;
      public String methodName="";
      private WebService ws;
      private ArrayList&lt;ServiceParam&gt; paramsList;
      private boolean hasParams; 
  
      public AsyncCallWs(Activity activity,String methodName) {
          xLog.position();
          try {
              this.dialog = new ProgressDialog(activity);
              this.methodName = methodName;
              hasParams = false;
          } catch (Exception e) {
              xLog.error(e.getMessage());
          }
      }
  
      public AsyncCallWs(Activity activity,String methodName,ArrayList&lt;ServiceParam&gt; params) {
          xLog.position();
          try {
              this.dialog = new ProgressDialog(activity);
              this.methodName = methodName;
              this.paramsList = params;
              hasParams = true;
          } catch (Exception e) {
              xLog.error(e.getMessage());
          }
      }
  
  
      @Override
      protected void onPreExecute() {
          this.dialog.setMessage(PersianReshape.reshape("Loading..."));
          this.dialog.show();
      }
  
      @Override
      protected String doInBackground(String... params) {
          xLog.position();
          String result = "No async task result!";
          try {
              ws = new WebService(PublicVariable.NAMESPACE, PublicVariable.URL);
              if (!hasParams){
                  result = ws.CallMethod(methodName);
              }
              else{
                  xLog.info("THIS METHOD IS: "+ methodName);
                  result = ws.CallMethod(methodName,paramsList);
                  xLog.info("THIS RESULT IS: "+ result);
              }
          } catch (Exception e) {
              xLog.error(e.getMessage());
          }
          return result;
      }
  
      @Override
      protected void onPostExecute(String result) {
          xLog.position();
  
          if (this.dialog.isShowing()) {
              this.dialog.dismiss();
          }
          xLog.info("Output of current AsyncTask is:"+ result);
      }
  }
  </code></pre>