简体   繁体   中英

Is there a way in Android studio of polling the light sensors rather than waiting for a SensorEvent?

I need a very high rate of information from the light_sensor in android studio and i can't get it with an event so i want the real time information if its possible

@Override
            public void onSensorChanged(SensorEvent event) {
                float value = event.values[0];
                currentTime = Calendar.getInstance().getTime();
                result[i] = formatter.format(currentTime);
                tab[i]=(int)value;
                Text.setText(String.valueOf(value));
                i=i+1;
            }

I think you mean on Android, and not in Android Studio. Android Studio is the IDE that you are using.

In general the light sensor on most Android devices only returns an onsensorchanged event when the light intensity changed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM