My application has a MainActivity which displays a fragment. In my fragment I have the following code:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
If I'm using the app (fragment) in portrait or reverse portrait mode it works perfectly. But when I tilt my phone in landscape the app (fragment) shows a black screen and then I can't do anything (not even use backstack for previous fragments). Only I can do is tilt phone back to portrait so the app runs correctly. Logcat don't give me much informations, because I don't get any exceptions. For some more informations I've add this to the MainActivity:
@Override
protected void onPause() {
Log.e("MainActivity", "onPause is called");
super.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
Log.e("MainActivity", "onSaveInstanceState is called");
super.onSaveInstanceState(outState);
}
After this little change, logcat showed me this when I'm going to landscape mode:
03-26 15:49:01.673 16103-16103/watado.de.watado E/MainActivity﹕ onPause is called
03-26 15:49:01.674 16103-16103/watado.de.watado E/MainActivity﹕ onSaveInstanceState is called
03-26 15:49:02.523 16103-16103/watado.de.watado E/MainActivity﹕ onPause is called
03-26 15:49:02.525 16103-16103/watado.de.watado E/MainActivity﹕ onSaveInstanceState is called
03-26 15:49:03.364 16103-16103/watado.de.watado E/MainActivity﹕ onPause is called
03-26 15:49:03.366 16103-16103/watado.de.watado E/MainActivity﹕ onSaveInstanceState is called
03-26 15:49:03.953 16103-16103/watado.de.watado E/MainActivity﹕ onPause is called
03-26 15:49:03.955 16103-16103/watado.de.watado E/MainActivity﹕ onSaveInstanceState is called
...
As you can see I think the MainActivity is stuck in a loop, but I don't know why and I don't now why portrait is working but landscape isn't. Does anyone know what my problem is or how I can solve this?
0 comments:
Post a Comment