title: Displaying a String of a java class in an activity widget
body: <p>I have an android app that consist of an activity and a java class that extends AsyncTask. So I have a String in the java class that called <strong>resFromServer</strong> 
  which I want to display it in a message in a suitable android widget like Alertdialog .</p>
  
  <p>I want someone to help me in how to access that String from the activity  </p>
  
  <pre><code>public class JSONTransmitter extends AsyncTask&lt;JSONObject, JSONObject, JSONObject&gt; {
  
      String url = "http://192.168.1.8:89/Derdeery/b.php";
  
  
  
      protected JSONObject doInBackground(JSONObject... data) {
          JSONObject json = data[0];
  
          HttpClient client = new DefaultHttpClient();
          HttpConnectionParams.setConnectionTimeout(client.getParams(), 100000);
          StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitNetwork().build());
          JSONObject jsonResponse = null;
  
          HttpPost post = new HttpPost(url);
  
          try {
              StringEntity se = new StringEntity("json="+json.toString());
  
              post.addHeader("content-type", "application/x-www-form-urlencoded");
              post.setEntity(se);
  
              HttpResponse response;
              response = client.execute(post);
              String resFromServer = org.apache.http.util.EntityUtils.toString(response.getEntity());
  
  
                 Log.i("Response from server", **resFromServer**);
  
  
          } 
          catch (Exception e)
          { e.printStackTrace();}
  
          return jsonResponse;
      }
  
  }
  </code></pre>
  
  <p>the activity</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) 
         {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          } }
  </code></pre>