1. Are you ready for the Galaxy S20? Here is everything we know so far!

Get values from accelerometer

Discussion in 'Android Development' started by milo8, Dec 27, 2013.

  1. milo8

    milo8 Lurker
    Thread Starter

    Hello everybody.. my problem is this, i have my main class and a second class that displays the values of the accelerometer on a textview.. however if i call my accelerometer class this is what happens, my application starts with no problems however no buttons work from my main class.. it seems to me that the accelerometer class runs above my main class thats why i have this problem.. what i did is i created a new activity on my manifest and called my accelerometer class from my main class using->
    Intent i = new Intent(this, AccelerometerClass.class);
    startActivity(i);
    Am i doing something wrong?

    Maybe there is a way to just take the values from the accelerometer class,wihout calling the class itself ???? what i mean is take the x,y,z(int) values from accelerometer class and set them on a text from the main class.. please help.. thnks :):):):):):thinking::thinking::thinking::thinking::thinking:
     



    1. Download the Forums for Android™ app!


      Download

       
  2. ocnbrze

    ocnbrze DON'T PANIC!!!!!!!!!

    moved you to the app develpoment forum for better help from the devs themselves;)
     
  3. cybersa

    cybersa Newbie

    What i understand?
    Two separate class to Display Accelerometer and text view.

    Why can't you use same class for displaying Accelerometer and textview?
     
  4. milo8

    milo8 Lurker
    Thread Starter

    My main class has many lines of code.. So i created a second class
    Tha shows the accelerometer values on a textview.. I just want to call that class
    When my app starts so i can display those values.. The main problem is thay when i call the second class'accelerometer' ovverides my main class and because of that nothing of my main class works .. For example when i call the acceleroneter class , a button that i have created on my main class wont work... I dont know what im doing wrong .. Please help:)
     
  5. cybersa

    cybersa Newbie

    Are you using two activity?
    If yes means you can Use Intent to transfer data.

    If one activity,and two class means,you have some logical error in your program.
    Check that.
     
  6. milo8

    milo8 Lurker
    Thread Starter

    No i have two classes , main and accelerometer.. In my manifest i set up a second activity so i can start the accelerometer class.. In simple words i have two classes and two activities.. Both activities start but the second one overrides the first one.. I mean i can see the values in textview created from the accelerometer class but buttons from main class wont work..
     
  7. milo8

    milo8 Lurker
    Thread Starter

    How can i take the values of accelerometer class using intent and display them in my main activity textview? Please:)
     
Loading...

Share This Page

Loading...