• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

CalledFromWrongThreadException in progressbar

 
Ranch Hand
Posts: 1325
1
  • 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



 
shawn peter
Ranch Hand
Posts: 1325
1
  • 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 PHP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to make progressbar final.
 
Ranch Hand
Posts: 69
2
Netbeans IDE C++ Linux
  • 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.
 
Beware the other head of science - it bites! Nibble on this message:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic