Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

CalledFromWrongThreadException in progressbar  RSS feed

 
Ranch Hand
Posts: 1288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a progress bar in my app.i am getting below exception when i disable to internet connection while downloading the files.





This is the part of code which contain the pregressbar.


the line 368 which contain errors is "progressBar.setVisibility(View.INVISIBLE);".
 
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



 
sam liya
Ranch Hand
Posts: 1288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the code as below.but same exception


 
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to make progressbar final.
 
Ranch Hand
Posts: 69
2
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception is pretty straight forward. Post a runnable to the UI thread that you created the progress bar on to update it.



If it seems verbose, clunky, ugly, and bug prone that's because it is. Lambdas should help to reduce the finger exercises when the dalvik bytecode specification is capable of supporting all Java 8 features.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!