Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7724749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:45:58+00:00 2026-06-01T04:45:58+00:00

I am new to android and working on accelerometer. I want to collect 20

  • 0

I am new to android and working on accelerometer. I want to collect 20 samples of x,y,z per second, for this can I use the following? registerListener(SensorEventListener listener, Sensor sensor, int rate)in the int rate can I use 3000000(microseconds) so that I get one x,y,z value for every 3000000(microseconds) or 3 seconds so it would be like registerListener(this, Accelerometer , 3000000); and get 20 samples of x,y,z in 1 seconds. If I am wrong can anyone suggest me how to solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:45:59+00:00Added an answer on June 1, 2026 at 4:45 am

    Check out the Javadocs for SensorManager.registerListener()

    You need to pass in one of the 4 constants, you cannot enter an arbitrary value like you are trying to do.

    The rate sensor events are delivered at. This is only a hint to the system. Events may be received faster or slower than the specified rate. Usually events are received faster. The value must be one of SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI, SENSOR_DELAY_GAME, or SENSOR_DELAY_FASTEST or, the desired delay between events in microsecond.

    so an example call might look like this:

    registerListener(this, Accelerometer , SensorManager.SENSOR_DELAY_FASTEST);
    

    EDIT: Tim.footInMouth() I didn’t see the last part of the definition. You can actually pass it microseconds.

    I think the math for your seconds is off a little

    You want 20 samples per second (1000 milliiseconds)

    So you want 1 sample per 50 milliseconds

    A microsecond is 1/1000 of a millisecond

    So 1000 microseconds = 1 milisecond

    and 50,000 microseconds = 50 millisecond = 20 times per second.

    So your call should be:

    registerListener(this, Accelerometer , 50000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new in android and working on the camera application. In this app
Hi i'm new android. i'm working through the samples and have an error when
I just started working on a new Eclipse Android project and want to make
I am new to Android and just started working with Android 4.0.3. which enables
I am new to android development,now I am working on C2DM implementation for android
I'm pretty new to Android dev and still working out a lot of things.
Is there any way, how to get new x86 image for Android emulator working
I am new to the android programming and my working environment is eclipse helio
I am new to JUnit and Android and good test documentation for working with
Hello i m new to android and working on Radio application i gt stuck

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.