viewing paste Unknown #1605 | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/** General AsyncTask */
  private static abstract class MALUAPITask<Result> extends AsyncTask<Void, Void, Result> {
    /** The handler for the retrieved data */
    protected final ConnectionHandler handler;
    protected final String url;
    public MALUAPITask(ConnectionHandler handler, String url) {
      this.handler = handler;
      this.url = url;
    }
    @Override
    protected Result doInBackground(Void... params) {
      String result = getResponseString(url);
      if(result != null && ! isCancelled()){
        return doInBackground(result);
      }
      return null;
    }
    
    /** Called when doInBackground has gotten the wanted data from the Connection */
    protected abstract Result doInBackground(String results);
  }
Viewed 750 times, submitted by Guest.