Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CalledFromWrongThreadException in progressbar

 
sam liya
Ranch Hand
Posts: 1243
  • 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);".
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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


 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to make progressbar final.
 
Luke Leber
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic