我需要在同步活动运行时更改进度对话框的内容它显示“同步数据” 当它完成后,它将进行另一个后台活动,并且仍然显示相同的文本,我想要的是在进入其他后台任务时更改文本?
protected void onPreExecute() {
mDialog = ProgressDialog.show(viewContext, "", "Synchronizing Data",
true);
};
/*
* (non-Javadoc)
*
* @see android.os.AsyncTask#doInBackground(Params[])
*/
@Override
protected Boolean doInBackground(Void... arg0) {
if (type.contains("ferry")) {
return SynchronizeRepositoryFerry(false);
} else {
boolean value = SynchronizeRepositories(false, initialSync);
mDialog.setTitle("Loading Images");//FROM HERE I WANT TO CHANGE DIALOG
com.jumbybay.businessobjects.User user = new com.jumbybay.businessobjects.User();
DatabaseHelper dbHelper = new DatabaseHelper(viewContext);
IUserRepository repository = dbHelper.getUserRepository();
List<com.jumbybay.businessobjects.User> imageList;
try {
int id;
String url = "http://i.zdnet.com/blogs/3-29-androids.jpg";
imageList = repository.Retrieve();
for (int i = 0; i < imageList.size(); i++) {
user = imageList.get(i);
// url = user.getPicture();
id = user.getId();
fetchImage fetch = new fetchImage();
fetch.savesd(id, url);
}
} catch (SQLException e) {
// TODO Auto-generated catch block// url = user.getPicture();
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return value;
}
}
protected void onProgressUpdate(Integer... progress) {
mDialog.setTitle("lOADING IMAGES...");
}
/*
* (non-Javadoc)
*
* @see android.os.AsyncTask#onPostExecute(java.lang.Object)
*/
@Override
protected void onPostExecute(Boolean result) {
this.syncComplete = result;
mDialog.dismiss();
Intent intent = new Intent();
intent.setClass(viewContext, classType);
viewContext.startActivity(intent);
}
答案 0 :(得分:0)
你试过像这样使用它吗
mDialog.setTitle("Loading Images");
mDialog.show();