Android - Accessing a variable in Activity (Using synchronization)
<p>I have a question in synchronization between threads in Android.  </p>

<p>What I have is:  </p>

<p>2 thread spawned from an activity, and each of this thread is accessing a field in the activity simultaneously.  </p>

<p>What I am thinking of is to use synchronize, such as  </p>

<pre><code>synchronize private void functionA()  
</code></pre>

<p>or  </p>

<pre><code>synchronize(mContext){  
....  
}  
</code></pre>

<p>(where mContext is context of activity)  </p>

<p>But I am not sure if it will really work.  </p>

<p>Or does anyone has any better ideas?  </p>

<p>Thanks.  </p>
