[Arriba] [Todas las Listas]

[android-developers] Re: SensorEvent timestamp No siempre actualizar

To: android-developers@xxxxxxxxxxxxxxxx
Subject: [android-developers] Re: SensorEvent timestamp No siempre actualizar
From: josean1968 <josean1968@xxxxxxxxx>
Date: Fri, 28 Oct 2011 15:38:30 -0700 (PDT)
Delivery-date: Mon, 31 Oct 2011 14:00:58 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=beta; h=x-beenthere:date:from:reply-to:to:message-id:in-reply-to:references :subject:mime-version:x-original-sender:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=OfVXYy8mbWpdoYI/Gd2Xi4ic9TCrExx5dxXrnBvyB4A=; b=fYO1NEYcaIZopsnQNOPK4NkvSx8JH3jWTpn6jae6i4I4LbSbU9L2Oq7goODaBJqm03 N5IUBjxH5MdcOpa7/Nf21P9uagWyVG1lCRlg4ulU/fwA1QOXurC3v+XbrWvttnDy3mdT 9sUnMnN8bbwLBqgJDPDobUJ3a73taJRFfyv3M=
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <27669871.2049.1319635856130.JavaMail.geo-discussion-forums@yqnv12>
List-archive: <>
List-help: <>, <>
List-id: <>
List-post: <>, <>
List-subscribe: <>, <>
List-unsubscribe: <>, <>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <27669871.2049.1319635856130.JavaMail.geo-discussion-forums@yqnv12>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx

tienes esto:

    Privado *SensorEvent *lastEvent;

    Público *void *onSensorChanged(*SensorEvent acontecimiento)
        #cnj (*lastEvent == *null)
            #unknown{^*lastEvent = acontecimiento;
        *Log.*v(TAG, "*dT [" + Hilo.*currentThread().*getName() + "]: " + 
(Acontecimiento.*timestamp - *lastEvent.*timestamp));


El problema es que el "*onSensorChanged()" el método puede ser invocado 
*concurrently porque es un acontecimiento *listener.
Declarar una variable local y copiar el valor (no justo un *pointer al 

    público *void *onSensorChanged(*SensorEvent acontecimiento)
      *int *lastTimestamp = Acontecimiento.*timestamp;

Recibiste este mensaje porque eres *subscribed al *Google
Grupos "*Android *Developers" grupo.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx

Puesto que más opciones, visita este grupo en

You have this:

    private SensorEvent lastEvent;

    public void onSensorChanged(SensorEvent event) {
        if (lastEvent == null) {
            lastEvent = event;
        Log.v(TAG, "dT [" + Thread.currentThread().getName() + "]: " + 
(event.timestamp - lastEvent.timestamp));


The problem is that the "onSensorChanged()" method can be invoked 
concurrently because it is an event listener.
Declare a local variable and copy the value (not just a pointer to the 

    public void onSensorChanged(SensorEvent event) {
      int lastTimestamp = event.timestamp;

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
For more options, visit this group at
<Anterior por Tema] Tema Actual [Siguiente por Tema>
  • [android-developers] Re: SensorEvent timestamp No siempre actualizar, josean1968 <=