I wanted to stop my activity from refreshing every time the orientation changes. I achieved this by implementing.
@Override public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);// Checks the orientation of the screen if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show(); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show(); } }
However when I remove the IF code to display the Toast, it stops working. Screen starts refreshing on the device. This works fine on emulator.
Has anyone faced this kind of issue ?
I finally solved this by using
http://roman-dotnet.blogspot.com/2011/05/android-webview-orientation-changes.html