issue returning data to activity from AsyncTask
<p>I am having trouble getting data back from an asynctask in a separate class firle into my main activity. </p>

<p>Here is my main activity:</p>

<pre><code>public class Main extends Activity {
EditText searchOne;
EditText searchTwo;

Button findMovies;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.totlayout);

    //set the UI elements
    searchOne = (EditText) findViewById(R.id.searchOne);
    searchTwo = (EditText) findViewById(R.id.searchTwo);

    findMovies = (Button) findViewById(R.id.findMovies);


}
public void displayResults(View view){
    //do something in response to button
    Intent intent = new Intent(this, DisplayResultsActivity.class);

    //make person search url1
    final StringBuilder personSearchURLOne = new StringBuilder(getName.getName1(searchOne)); 
    final String searchURLOne = personSearchURLOne.toString();
    Log.d("searchurlone", searchURLOne.toString());

    //make person search url2
    final StringBuilder personSearchURLTwo = new StringBuilder(getName.getName2(searchTwo));
    final String searchURLTwo = personSearchURLTwo.toString();

    //get ID 1 this needs to get data back from asynctask in the type string to be passed to buildCreditURL
    new getFirstID().execute(searchURLOne);

    //get ID 2
    new getFirstID().execute(searchURLTwo);

    //make credit search url1
    final StringBuilder creditURLOne = new StringBuilder(buildCreditURL.getCreditURLOne(firstID));
</code></pre>

<p>Here is my separate class file containing my AsyncTask:</p>

<pre><code>package com.tot.tipofthetongue;

import android.os.AsyncTask;

import android.util.Log;





import org.json.JSONArray;
import org.json.JSONException;

import org.json.JSONObject;

public class getFirstID extends AsyncTask&lt;String, Void, String&gt; {

public static String TAG_ID = "id";
public static String TAG_RESULTS = "results";


String personOne = null;
static String firstID = null;


@Override
protected String doInBackground(String... personSearchURLOne) {
    Log.d("personSearchURLOne in getFirstID containts", personSearchURLOne[0]);

    JSONArray results = null;

    JSONParser jParser = new JSONParser();

    JSONObject jSon = jParser.doInBackground(personSearchURLOne[0]);

    try{
        results = jSon.getJSONArray(TAG_RESULTS);

        for(int i = 0; i &lt; results.length(); i++){
            JSONObject r = results.getJSONObject(i);
            firstID = r.getString(TAG_ID);

        }


    }
    catch(JSONException e){
        Log.e("Error", e.toString());
    }
            /need this value as string to be passed back to the main activity
    return firstID;


}




}
</code></pre>

<p>How do I firstID out as a string into my main activity to it can be used in another method belonging to another separate class file. </p>

<p>UPDATED getFirstID:</p>

<pre><code>package com.tot.tipofthetongue;


import android.os.AsyncTask;

import android.util.Log;





import org.json.JSONArray;
import org.json.JSONException;

import org.json.JSONObject;

 public class getFirstID extends AsyncTask&lt;String, Void, String&gt; {

public static String TAG_ID = "id";
public static String TAG_RESULTS = "results";


String personOne = null;
static String firstID = null;


@Override
protected String doInBackground(String... personSearchURLOne) {

    Log.d("personSearchURLOne in getFirstID containts", personSearchURLOne[0]);

    JSONArray results = null;

    JSONParser jParser = new JSONParser();

    JSONObject jSon = jParser.doInBackground(personSearchURLOne[0]);

    try{
        results = jSon.getJSONArray(TAG_RESULTS);

        for(int i = 0; i &lt; results.length(); i++){
            JSONObject r = results.getJSONObject(i);
            firstID = r.getString(TAG_ID);

        }


    }
    catch(JSONException e){
        Log.e("Error", e.toString());
    }
    return firstID;


}
@Override
public void onPostExecute(String firstID){

}




}
</code></pre>
