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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -