1. Download our Official Android App: Forums for Android!

Apps Get values from accelerometer

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

  1. milo8

    milo8 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Dec 12, 2013

    Dec 12, 2013
    4
    0
    5
    Male
    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:
     

    Advertisement

  2. ocnbrze

    ocnbrze DON'T PANIC!!!!!!!!!
    Rank:
     #7
    Points:
    3,108
    Posts:
    27,182
    Joined:
    May 13, 2010

    May 13, 2010
    27,182
    17,108
    3,108
    Male
    being a flashaholic sponsor, helping others gettin
    los angeles
    moved you to the app develpoment forum for better help from the devs themselves;)
     
  3. cybersa

    cybersa Newbie
    Rank:
    None
    Points:
    36
    Posts:
    36
    Joined:
    Dec 21, 2013

    Dec 21, 2013
    36
    2
    36
    Male
    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
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Dec 12, 2013

    Dec 12, 2013
    4
    0
    5
    Male
    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
    Rank:
    None
    Points:
    36
    Posts:
    36
    Joined:
    Dec 21, 2013

    Dec 21, 2013
    36
    2
    36
    Male
    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
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Dec 12, 2013

    Dec 12, 2013
    4
    0
    5
    Male
    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
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Dec 12, 2013

    Dec 12, 2013
    4
    0
    5
    Male
    How can i take the values of accelerometer class using intent and display them in my main activity textview? Please:)
     

Share This Page

Loading...