Hi,

Simply put "synchronized(this)" will stop multilpe threads changing
the data in your class via all methods that are also "synchronized
(this)".

Have a read of 
http://java.sun.com/docs/books/tutorial/essential/concurrency/sync.html

However I think that the interface you are using (SensorListener) has
been deprecated and you should now be using SensorEventListener
http://developer.android.com/reference/android/hardware/SensorEventListener.html

--
RichardC

"Used for receiving notifications from the SensorManager when sensor
values have changed. This interface is deprecated, use
SensorEventListener instead."

On Oct 10, 11:10 am, DD <[email protected]> wrote:
> Hi, I have a pretty simple question. For
>
> public void onSensorChanged (int sensor, float[] values){synchronized
> (this) {
>
> what's "synchronized (this) " for...? I'm really new to Java...what's
> gonna happen if I dont have this? Thank you very much.!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to