title: Return Value In Runnable
body: <p>I have a custom adapter that <code>buttons</code> and <code>TextView</code>, the <code>TextView</code> is changed on a <code>button</code> click within <code>listview</code> and it after sending and receiving feedback from <code>http</code> <code>Post</code> via <code>Json</code> response, I tried using <code>runnable</code> and <code>assynctask</code> but no success. In the runnable, I can not return a value from the method.    </p>
  
  <p>What I wanted is to send <code>http</code> request to the server and return <code>json</code> results, based on the returned results, the <code>TextView</code> will change.</p>
  
  <p>What is the best approach to use to achieve this.</p>
  
  <p>If any one can help point me to a resource that will help me to achieve this will be highly welcome.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Here is my code..</p>
  
  <pre><code>    public String getStatus(final String id, final String user){
          final String[] resp = {"0/0/0"};
  
          new Thread(new Runnable() {
              @Override
              public void run() {
  
                  // Building Parameters
                  final List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
                  params.add(new BasicNameValuePair("username", user));
                  params.add(new BasicNameValuePair("id", id));
  
                  Log.d("Nay Params", "" + params);
                  // getting product details by making HTTP request
                  JSONObject json = jsonParser.makeHttpRequest(NAY_URL, "POST",
                          params);
  
                  // check your log for json response
                  // json success tag
  
                  try {
  
                      Log.d("Nay Response", ""+ json);
                      success = json.getBoolean(TAG_SUCCESS);
                      yeaSt = json.getBoolean(TAG_E_STATUS);
                      naySt = json.getBoolean(TAG_A_STATUS);
                      yeaC = json.getInt(TAG_YEA);
                      nayC = json.getInt(TAG_NAY);
                      if (success){
                     resp[0] = yeaS + "/" + naySt + "/" + yeaC + "/" + nayC;
  
                             return resp[0];  
  //Can not return return value within void method that is; Class void run()
  
                          }
  
  
  
                  } catch (JSONException e) {
                  e.printStackTrace();
                  //return resp[0];
  
              }
  
          }
  
  
  
          }).start();
  //Can not acces json result outside the try catch block
          Log.d("sux", ""+success);
  
      //       Log.d("Rest1", resp[0]);
  
          return resp[0];
      }
  </code></pre>