开发者

Is there a method like onrotate() or something with a similar functionality in Android?

I call a method based on a boolean value. I try setting that value in onRetainNonConfigurationInstance() to handle screen rotation but somehow it does not call the function correctly. What is the best method to call that will allow me to this:

public void methodName() //ideally something like o开发者_JAVA百科nRotate()
{
  if (booleanValue == true)
  {
    booleanValue2 = false;
    method1();
   }
   else
  {
    booleanValue2 = true;
    method2();
   }
}

here


Maybe you're looking for this: http://developer.android.com/reference/android/view/OrientationListener.html

onOrientationChanged(int)

Called when the orientation of the device has changed. orientation parameter is in degrees, ranging from 0 to 359. orientation is 0 degrees when the device is oriented in its natural position, 90 degrees when its left side is at the top, 180 degrees when it is upside down, and 270 degrees when its right side is to the top. ORIENTATION_UNKNOWN is returned when the device is close to flat and the orientation cannot be determined.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜