• Post Reply Bookmark Topic Watch Topic
  • New Topic

notify main thread  RSS feed

 
Kothari Ankur
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to tell main thread to execute a statement when a boolean becomes true in another thread? I was guessing wait and notify could be of use here but then i need to synchronise on something. Then i tried join method but it immediately stops my main thread and the UI stops taking any user presses on android
 
Andrey Kozhanov
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, wait and notify could do the trick, as well as locking functionality of java.util.concurrent package. And you could synchronize on any object you like - it only should be visible to both threads. For example:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!