title: Sharing Variable information between classes
body: <p>Okay, So i have my main class</p>
  
  <pre><code>public class ViewSpotActivity extends Activity {...}
  </code></pre>
  
  <p>In onCreate() new GetSpotDetails().execute(); is called.</p>
  
  <p>Get Spot details looks like this:</p>
  
  <pre><code>class GetSpotDetails extends AsyncTask&lt;String, String, JSONObject&gt; {
          /**
           * Before starting background thread Show Progress Dialog
           * */
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              pDialog = new ProgressDialog(ViewSpotActivity.this);
              pDialog.setMessage("Loading Spot details. Please wait...");
              pDialog.setIndeterminate(false);
              pDialog.setCancelable(false);
              pDialog.show();
          }
          /**
           * Getting details in background thread
           * */
          protected JSONObject doInBackground(String... String) {
              JSONObject spot = null;
              // Check for success tag
              int success;
              try {
                  // Building Parameters
                  List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
                  params.add(new BasicNameValuePair("pid", pid));
                  // getting details by making HTTP request
                  // Note that details url will use GET request
                  JSONObject json = jsonParser.makeHttpRequest(
                          url_detials, "GET", params);
                  // check your log for json response
                  Log.d("Single Spot Details", json.toString());
                  // json success tag
                  success = json.getInt(TAG_SUCCESS);
                  if (success == 1) {
                      // successfully received product details
                      JSONArray spotObj = json
                              .getJSONArray(TAG_SPOT); // JSON Array
                      // get first product object from JSON Array
                      int value = Integer.parseInt(pid);
                       int n=0;
                    while(Integer.parseInt(spotObj.getJSONObject((n)).getString(TAG_PID))!=value){
                       n++;
                      }
                      spot = spotObj.getJSONObject((n));
                  }else{
                      // product with pid not found
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              return spot;
          }
          /**
           * After completing background task Dismiss the progress dialog
           * **/
          protected void onPostExecute(JSONObject spot) {
              if (spot != null) {
                  setContentView(R.layout.view_spot);
                  // pid found
                  // Edit Text
                  txtName = (TextView) findViewById(R.id.outputName);
                  txtLong = (TextView) findViewById(R.id.outputLong);
                  txtLat = (TextView) findViewById(R.id.outputLat);
                  txtPavement = (TextView) findViewById(R.id.outputPavement);
                  txtTraffic = (TextView) findViewById(R.id.outputTraffic);
                  txtEnvironment = (TextView) findViewById(R.id.outputEnvironment);
                  //need to add rest...
                  // display data in Text
                  try {
                      //need to add rest...
                      txtName.setText("Spot Name: " + spot.getString(TAG_NAME));
                      txtLong.setText("Longitude: " + spot.getString(TAG_LONG));
                      txtLat.setText("Latitude: " + spot.getString(TAG_LAT));
                      txtPavement.setText("Pavement: " + spot.getString(TAG_PAVEMENT));
                      txtTraffic.setText("Traffic: " + spot.getString(TAG_TRAFFIC));
                      txtEnvironment.setText("Environment: " + spot.getString(TAG_ENVIRONMENT));
                  } catch (JSONException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
              }
              // dismiss the dialog once got all details
              pDialog.dismiss();
          }
      }
  }
  </code></pre>
  
  <p>I want to be able to get the information in spot.getString(TAG_LONG) and spot.getString(TAG_LAT) and use them in an onClick that is under onCreate. Is there any way to do this without recalling new GetSpotDetails().execute();. Sorry if it's a simple answer I'm fairly new to programming on android.</p>
  
  <p>Thank you,
  Tyler</p>