title: Return ArrayList from void AsyncTask
body: <p>I <code>Googled</code> alot, but no chance for this.
  For now, i a have an <code>Inner AsyncTask</code> class that i want to use the return values in the upper class.
  And it successfully work, cause i have put a <code>Log.e()</code> and it shows my value, Here is my code : </p>
  
  <pre><code>   public class Consume extends AsyncTask&lt;Void, Void, Void&gt; {
          private List&lt;LatLng&gt; latLngs = new ArrayList&lt;&gt;();
          private List&lt;ContactModel&gt; contacts = new ArrayList&lt;&gt;();
          InputStream inputStream = null;
          String result = "";
  
          @Override
          protected Void doInBackground(Void... params) {
  
              String URL = "http://x.x.x.x/MYWCF/Service1.svc/Json/getContact";
              ArrayList&lt;NameValuePair&gt; param = new ArrayList&lt;NameValuePair&gt;();
              try {
                  HttpClient httpClient = new DefaultHttpClient();
                  HttpPost post = new HttpPost(URL);
                  post.setEntity(new UrlEncodedFormEntity(param));
                  HttpResponse httpResponse = httpClient.execute(post);
                  HttpEntity httpEntity = httpResponse.getEntity();
                  inputStream = httpEntity.getContent();
  
              } catch (UnsupportedEncodingException e1) {
                  Log.e("UnsupportedEncoding", e1.toString());
                  e1.printStackTrace();
              } catch (ClientProtocolException e2) {
                  Log.e("ClientProtocolException", e2.toString());
                  e2.printStackTrace();
              } catch (IllegalStateException e3) {
                  Log.e("IllegalStateException", e3.toString());
                  e3.printStackTrace();
              } catch (IOException e4) {
                  Log.e("IOException", e4.toString());
                  e4.printStackTrace();
              }
              try {
                  BufferedReader bReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
                  StringBuilder sBuilder = new StringBuilder();
  
                  String line = null;
                  while ((line = bReader.readLine()) != null) {
                      sBuilder.append(line + "\n");
                  }
                  inputStream.close();
                  result = sBuilder.toString();
              } catch (Exception e) {
                  Log.e("StringBuilding", "Error converting result " + e.toString());
              }
              return null;
          }
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
  
          @Override
          protected void onPostExecute(Void aVoid) {
              super.onPostExecute(aVoid);
              List&lt;ContactModel&gt; contactModels;
              List&lt;LatLng&gt; myLatLngs = new ArrayList&lt;&gt;();
              try {
  
                  JSONObject object = new JSONObject(result);
                  JSONArray jArray = object.getJSONArray("getContactResult");
  
                  Type listType = new TypeToken&lt;List&lt;ContactModel&gt;&gt;() {
                  }.getType();
                  contactModels = new Gson().fromJson(String.valueOf(jArray), listType);
                  setContacts(contactModels);
  
                  setContacts(contactModels);
                  for(ContactModel contactModel : contactModels) {
                      Double latitude = Double.valueOf(contactModel.getLatitude());
                      Double longitude = Double.valueOf(contactModel.getLongitude());
                      LatLng latLong = new LatLng(latitude, longitude);
                      myLatLngs.add(latLong);
                  }
                  setLatLngs(myLatLngs);
                  Log.e("SizeOfArray", myLatLngs.size()+"");
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
  
      public void setContacts(List&lt;ContactModel&gt; contacts) {
          this.contacts = contacts;
      }
  
      public List&lt;ContactModel&gt; getContacts() {
          return contacts;
      }
  
      public void setLatLngs(List&lt;LatLng&gt; latLngs) {
          this.latLngs = latLngs;
      }
      public List&lt;LatLng&gt; getLatLngs() {
          return latLngs;
      }
  </code></pre>
  
  <p>And in my <code>Activity Class</code> : </p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.osmdroid_map);
  
  
      Consume consume = new Consume();
      consume.execute();
  </code></pre>
  
  <p>When i run the app, cause of the line : </p>
  
  <pre><code>                Log.e("SizeOfArray", myLatLngs.size()+"");
  </code></pre>
  
  <p>it returns me the correct int number of array size in <code>logcat</code>, But i want to use that in my App,
  I even do all stuff in <code>doInBackground</code> method, and even make a <code>static</code> variable,
  No chance.
  Can any one give a real sample by my code?
  Thx</p>