Animated TextView Not Updating.. Ok. Here is my problem.. I am a little new to android dev.. I'm having a hard time understanding 2D graphics..
I was able to make my Layout rotated like iPhone's LandscapeLeft to LandscapeRight.. It has a TextView that updated with accelerometer values... The problem is that after the animation the TextView stops updating.. I have read that this type of animation only moves the view.. and that everything else is still in it's previous position... Can someone help me understand. I have attached my project in case somebody wanted to look at it.. ANY suggestions would be much appreciated.. Thanks.. The project is also in Github https://github.com/miscventura/AnimatingUpdatingTextView Here is the code.. package org.example.hello; import android.app.Activity; ....... import android.widget.TextView; public class Hello extends Activity implements SensorEventListener { /** Called when the activity is first created. */ Camera camera; SurfaceView surfaceView; SurfaceHolder surfaceHolder; boolean previewing = false; LayoutInflater controlInflater = null; TextView numbersView; TextView numbersView2; // for orientation change OrientationEventListener mOrientationEventListener; int mDeviceOrientation; public SensorManager sensorManager = null; float accelerationX; float accelerationY; // ///Orientation////// static final int lanscapeLeft = 2; static final int lanscapeRight = 1; int orientation = 2; View viewControl; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ******************************************* // full screen mode // ******************************************* requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FL AG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // ******************************************* sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); //sets a floating layer viewControl = getLayoutInflater().inflate(R.layout.mainview, null); setContentView(viewControl); numbersView = (TextView) findViewById(R.id.numbersview); numbersView2 = (TextView) findViewById(R.id.numbersview2); mOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { @Override public void onOrientationChanged(int orientation) { mDeviceOrientation = orientation; } }; if (mOrientationEventListener.canDetectOrientation()) { mOrientationEventListener.enable(); } } // /////////////////////////////////////////////////////////////////////////////////// // /////////////////////////ACCELEROMETER SET // UP///////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////// @Override protected void onResume() { super.onResume(); // Register this class as a listener for the accelerometer sensor sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELER OMETER), SensorManager.SENSOR_DELAY_GAME); } public void onAccuracyChanged(Sensor arg0, int arg1) { // TODO Auto-generated method stub } public void onSensorChanged(SensorEvent event) { // TODO Auto-generated method stub synchronized (this) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { // high-pass filter to eliminate gravity accelerationX = event.values[0]; accelerationY = event.values[1]; String accValue = String.format("%.1f", accelerationX); String accValue2 = String.format("%.1f", accelerationY); if (mDeviceOrientation <= 300 && mDeviceOrientation >= 240) { animateRootViewToLanscapeLeft(viewControl); } if (mDeviceOrientation >= 60 && mDeviceOrientation <= 120) { animateRootViewToLanscapeRight(viewControl); } numbersView.setText(accValue); numbersView2.setText(accValue2); } } } public void animateRootViewToLanscapeLeft(View view) { if (orientation == lanscapeRight) { Animation spin = AnimationUtils.loadAnimation( getApplicationContext(), R.anim.tolandscapeleft); view.setAnimation(spin); spin.setFillAfter(true); spin.start(); orientation = lanscapeLeft; } } public void animateRootViewToLanscapeRight(View view) { if (orientation == lanscapeLeft) { Animation spin = AnimationUtils.loadAnimation( getApplicationContext(), R.anim.tolandscaperight); view.setAnimation(spin); spin.setFillAfter(true); spin.start(); orientation = lanscapeRight; } } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

