如何从异步调用onPostExecute返回结果字符串?我怎么称呼它?我似乎无法让我的代码能够做到这一点.线程应该没有问题,因为我有一个冻结UI的对话框,直到完成工作.
我的典型asyncTask代码如下
class GetDataFromServer extends AsyncTaskPHP";
public myAsyncMethos(String dialogMessage,Context con)
{
this.qDialog = new ProgressDialog(con);
this.dialogString = dialogMessage;
this.context = con;
}
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute()
{
super.onPreExecute();
qDialog = new ProgressDialog(this.context);
qDialog.setMessage(this.dialogString);
qDialog.setIndeterminate(false);
qDialog.setCancelable(false);
qDialog.show();
}
@Override
protected JSONObject doInBackground(String... args)
{
//MAKE SERVER CALL and cast to JSONOBject
return jsonNewUser;
}
public void onPostExecute(JSONObject jsonString)
{
// dismiss the dialog after getting response
qDialog.dismiss();
//I WANT TO RETURN A STRING HERE BUT KEEP GETTING Syntax ERRORS BEFORE RUNTIME
}
}