include android:configChanges="orientation" in AndroidManifest.xml in the activity display window. Doing this tells the android that you are going to handle the orientation change yourself, and ultimately it will not ruin your activity and will not display a window.
This technique is good if you do not have different layouts for portrait and landscape mode. However, if you do this, you can still implement the custom layout by specifying an orientation mode, as shown below:
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) Log.i("orientation", "Orientation changed to: Landscape"); else Log.i("orientation", "Orientation changed to: Portrait"); }
to preview, download, and install this sample application .
waqaslam
source share