2011-03-24 27 views
0

我需要將屏幕方向鎖定很短的時間,以便用戶當前所處的方向。我知道讓你做的當前方位:我在哪裏可以找到代表屏幕方向的整數

Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); 

int orientation = display.getOrientation(); 

但後來我需要能夠比較它代表了不同的方向,像這樣的整數:

if (orientation == MysteryAndroidClass.ORIENTATION_PORTRAIT) 
{ 
    //lock orientation in portrait 
} 

else 
{ 
    //lock orientation in landscape 
} 

的問題是,我無法在文檔中的任何位置找到這些常量。也許有人知道如何訪問它們?

回答

相關問題