문제

What I want to build;

App ALWAYS is in landscape mode (top of phone to the left!).

When the user flips the phone (over Y-axis, so user is looking at it's back, screen is in front of person sitting on the other end of the table) the orentation should change to Reversed Landscape. In that scenario, the TextView that is showing, will be right-side-up for the person looking at the screen.

Then, when the user flips back the phone, the orientation should change back to landscape.

But... (and here's the catch..) when the user turns the phone over the X-Axis (so looking at the screen, turns it (couter)clockwise, nothing should happen. (in the game, this would be cheating)

I tried using the onSensorChanged, but it doesn't behave like I described. Any thoughts? Thnx

public void onSensorChanged(SensorEvent event) {  

                TextView tv = (TextView) findViewById(R.id.TextView01);
                tv.setText("0 : " + event.values[0] + "1 : " + event.values[1] + " -- 2 : " + event.values[2]);

                if (event.values[1] < -6 || event.values[1] > 6) {
                    playfair();
                    return;
                } else {if (event.values[1] > -6 || event.values[1] < 6){cheat = false;}}
                if (event.values[0] < -8.5) {
                    if (state == PRE_ROUND)
                    startround();                                               
                } else {
                    if (state == SHOWING_OBJECT){
                        flipper.setInAnimation(inFromBottomAnimation(1));
                        flipper.setOutAnimation(outToTopAnimation(1));
                        flipper.setDisplayedChild(1);

                        state = PRE_ROUND;  
                    }

                }                   
            }

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top