I have objects that I need to display in 1 thread and also continuously update in a 2. thread. Is there a recommended way for Java on Android to handle this kind of access (lock/unlock) to an object like a mutex or something like that ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to synchronize between threads then it’s the same as for Java on anywhere else: there is no special android.concurrent package.
Android has some classes that help with concurrency in general like Handler & AsyncTask but those are more about switching thread contexts. Still they might be the answer to your question: if used properly you may not need to synchronize.