如何将OnPostExecute()的结果导入主活动,因为AsyncTask是一个单独的类?
我有这两节课。我的主要活动和扩展的一个AsyncTask,现在在我的主要活动,我需要从得到的结果OnPostExecute()中AsyncTask。我怎样才能将结果传递给我的主要活动?
这是示例代码。
我的主要活动。
public class MainActivity extends Activity{
    AasyncTask asyncTask = new AasyncTask();
    @Override
    public void onCreate(Bundle aBundle) {
        super.onCreate(aBundle);            
        //Calling the AsyncTask class to start to execute.  
        asyncTask.execute(a.targetServer); 
        //Creating a TextView.
        TextView displayUI = asyncTask.dataDisplay;
        displayUI = new TextView(this);
        this.setContentView(tTextView); 
    }}这是AsyncTask类
public class AasyncTask extends AsyncTask<String, Void, String> {TextView dataDisplay; 
//store the data  String soapAction = " 
 //SOAPAction header line. String targetServer = "https://sampletargeturl.com";
  //Target Server.//SOAP Request.String soapRequest = "<sample XML request>";    
  @Overrideprotected String doInBackground(String... string) {String responseStorage = null; //storage of the responsetry {
    //Uses URL and HttpURLConnection for server connection. 
    URL targetURL = new URL(targetServer);
    HttpURLConnection httpCon = (HttpURLConnection) targetURL.openConnection();
    httpCon.setDoOutput(true);
    httpCon.setDoInput(true);
    httpCon.setUseCaches(false); 
    httpCon.setChunkedStreamingMode(0);
    //properties of SOAPAction header
    httpCon.addRequestProperty("SOAPAction", soapAction);
    httpCon.addRequestProperty("Content-Type", "text/xml; charset=utf-8"); 
    httpCon.addRequestProperty("Content-Length", "" + soapRequest.length());
    httpCon.setRequestMethod(HttpPost.METHOD_NAME);
    //sending request to the server.
    OutputStream outputStream = httpCon.getOutputStream(); 
    Writer writer = new OutputStreamWriter(outputStream);
    writer.write(soapRequest);
    writer.flush();
    writer.close();天涯尽头无女友
慕桂英546537