android - Progress Bar With Different Messages For Different Files -
i have implemented progress bar downloading 2 files, progressbar follows
@override protected dialog oncreatedialog(int id) { switch (id) { case progress_bar_type: // set 0 pdialog = new progressdialog(this); if (x.equals("xp")) { pdialog.setmessage("downloading file. please wait..."); } if (x.equals("xv")) { pdialog.setmessage("updating file. please wait..."); } pdialog.setindeterminate(false); pdialog.setmax(100); pdialog.setprogressstyle(progressdialog.style_horizontal); pdialog.setcancelable(true); pdialog.show(); return pdialog; default: return null; } }
i display different massage each of 2 files (downloading , updating).
- i press button
- it calls class (x = xp) downloads file (message downlaoding)
- class calls class b (x = xv) downloads second file(message updating)
- however x not known when progressbar launches
- if set x @ onclick button x remain same value through entire button event though event launches 2 classes x defined in them , therefore message downloading both files. hope makes sense.
you can change message of progressdialog dynamically, once x
can set message appropriate one. avoid confusion, try updating message in class , class b if running in ui thread.
Comments
Post a Comment