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 7495789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:19:38+00:00 2026-05-29T18:19:38+00:00

I am new to java for android and come from an actionscript 3.0 background.

  • 0

I am new to java for android and come from an actionscript 3.0 background. I am playing with the sensor manager and want to trace my direction to see if its working and such.. below is the code i am using to detect a change in direction/heading and i am wondering how to actually see my direction variable change in real time either via a trace or a text out put right on the display of my device:

    SensorEventListener listener = new SensorEventListener(){

            @Override
            public void onAccuracyChanged(Sensor sensor, int accuracy) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onSensorChanged(SensorEvent evt) {
                float vals[] = evt.values;
                float direction = vals[0];

            }

any help is greatly appreciated by this novice..

  • 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-05-29T18:19:40+00:00Added an answer on May 29, 2026 at 6:19 pm

    Assuming your code is in an Activity class, one thing you could do is:

     @Override
            public void onSensorChanged(SensorEvent evt) {
                float vals[] = evt.values;
                float direction = vals[0];
                setTitle("Direction = " + direction);
            }
    

    This will display the direction on the Activity’s title bar.

    If you want to record the values of direction, do this instead:

         @Override
            public void onSensorChanged(SensorEvent evt) {
                float vals[] = evt.values;
                float direction = vals[0];
                Log.d("A Log Tag", "Direction = " + direction);
            }
    

    That will log the values to LogCat, which you can view in eclipse.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This tutorial come from android-er , The main activity(AndroidScheduledActivity.java) start a AlarmManager to trigger
Another question about my implementation. I am fairly new to java/android coming from a
I'm new to Java/Eclipse/Android, so this is probably an easy (if not stupid) question:
I have to admit that I'm new to Java and Android. db4o seems to
Firstly I am new to android and Java so this is a beginners question.
I am completely new to android, and pretty much a Java newb. I have
I'm a relatively new Java programmer coming from C++/STL, and am looking for a
I'm pretty new to Android and Java, though I've really been excited about what
I am new to Android and also to java. in my application exactly what
I'm relatively new to java and android development so sorry if this is a

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.