java AYSNTASK在应该调用onPostExecute方法时不会调用它
在Asynctask中,不会调用onPostExecute方法,但是,在doinbackground中,在该方法之后也不会打印Logcat。有什么想法吗
public class connectTask extends AsyncTask<String,String,String[]>
{
String FilmId, Name, Certificate, Duration, Director, Description, ReleaseDate, Cast;
@Override
protected String[] doInBackground(String... params) {
//we create a TCPClient object and
mTcpClient = new TCPClient(new TCPClient.OnMessageReceived() {
@Override
//here the messageReceived method is implemented
public void messageReceived(String message) {
//this method calls the onProgressUpdate
//Log.e("TCP Client", message);
try
{
JSONObject json = new JSONObject(message);
FilmId = (String) json.get("FilmId");
Name = (String) json.get("Name");
Certificate = (String) json.get("Certificate");
Duration =(String) json.get("Duration");
Director = (String) json.get("Director");
Description = (String) json.get("Description");
ReleaseDate = (String) json.get("ReleaseDate");
Cast = (String) json.get("Cast");
Log.e("FilmId: ", FilmId);
Log.e("Name: ", Name);
Log.e("Cert: ", Certificate);
Log.e("Duration: ", Duration);
Log.e("Director: ", Director);
Log.e("Description: ", Description);
Log.e("ReleaseDate: ", ReleaseDate);
Log.e("Cast: ", Cast);
JSON[0] = FilmId;
JSON[1] = Name;
System.out.println(JSON[1]);
Log.e("work","work");
}
catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
mTcpClient.run("");
Log.e("work","please");
return null;
}
@Override
protected void onPostExecute(String[] result) {
// TODO Auto-generated method stub
Log.e("work","goddammit");
Intent FilmInfo = new Intent(FullscreenActivity.this, FilmInfo.class);
FilmInfo.putExtra("NamePass", JSON[1]);
FullscreenActivity.this.startActivity(FilmInfo);
super.onPostExecute(result);
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
}
我已经检查了其他各种问题,但都没有帮助。 我使用Override/Implement方法在Eclipse中自动创建了这些方法,以确保它们的格式正确
共 (0) 个答案