这是异步任务中的proccess对话框中的问题
我经常搜索,找出 proccessDialog在Async任务中的原因是SlowDown 你放入doInBackground的速度。
任何人都可以说为什么会发生......
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
Asycdialog = new ProgressDialog(Server_connection.this);
Asycdialog.setMessage("Checking Connection.......");
Asycdialog.setCanceledOnTouchOutside(false);
Asycdialog.show();
field_res_partner = mf.fields_res_partner();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OVersionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//
}
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
sync_data_server.Search_read(Server_connection.this, "res.partner",
field_res_partner);
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
Asycdialog.dismiss();
// Intent intent = new Intent(Server_connection.this,
// SplashMenu.class);
// startActivity(intent);
}
答案 0 :(得分:0)
使用
protected void onProgressUpdate(Integer... progress) {
setProgressPercent(progress[0]);
}
更新您的进度并:
publishProgress (Progress... values)
将更新状态发送到进度