title: How to get value from new Thread(new Runnable() { public void run() {} in Android
body: <p>Here is my code and in my class I have declared ansResultinThread varible as follows. </p>
  
  <pre><code>protected static  String ansResultinThread = "";
  </code></pre>
  
  <p>Whne I try to access to ansResultinThread value after the callServerForResult method is completed. I am not getting the Updated value.</p>
  
  <pre><code>public void callServerForResult(String ans, String casCmd) {
  
      // String ParsedEquation = parseQuestionForSymPy(ans);
      String ParsedEquation = ans;
  
      final String stringUrl = "http://localhost:40001/" + casCmd + "/"
              + ParsedEquation;
  
      new Thread(new Runnable() {
          public void run() {
              String Result = "";
              try {
                  Result = GetServerResult(stringUrl);
  
              } catch (IOException e) {
                  System.out.println(e);
              }
              ansResultinThread = Result;
          }
      }).start();
  }
  </code></pre>
  
  <p>How to fix this Issue.</p>