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).

  1. i press button
  2. it calls class (x = xp) downloads file (message downlaoding)
  3. class calls class b (x = xv) downloads second file(message updating)
  4. however x not known when progressbar launches
  5. 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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -