Orientation in android
I am using the following snippet for screen orientation in android..
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
// ---change to landscape mode---
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_开发者_JAVA技巧LANDSCAPE);
// ---change to portrait mode---
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
This snippet is working with in application.. and its not working in SDK 1.5..
My question is is there anyway to do screen orientation out side the application..ie for example if i use the timer and came out of my application i cannot see any orientation...but when i am clicking on my application again then i can see screen orientation..Is there any way to do screen Orientation out side the application through program..
Why are you trying to set the orientation programmatically? That sounds like a really bad idea.
If you want to restrict your app to one screen orientation, you should do that through the screenOrientation attribute in the manifest.
精彩评论