I have two activity. The app starts, I start the second activity. I rotate the device. I go back to the first activity. Black area shows up during the animation. This is way I set
android:configChanges="keyboardHidden|orientation|screenSize"
in my activities. If I don't, everything works fine.
How do I fix this?
I know I have to implement onConfigurationChanged
Here's the code:
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initUI();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
initUI();
}
private void initUI()
{
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent subActivity = new Intent(MainActivity.this,SecondActivity.class);
startActivity(subActivity);
}
});
}
}
and second:
public class SecondActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.temp);
}
}
Here's a video of that happens: http://www.youtube.com/watch?v=8NLNkE1eOK8
This is not, of course, the project that I'm working on but it's an example specifically created to let understand this issue.
Thanks.