First of all, I have already read the official documentation including disadvantages of using "onConfigurationChanged" and "configChanges attribute" in the manifest and skipping OnCreate.
However, sometimes its usage can be justified, for instance when using VideoView and an orientation change takes place. In this case, using the "configChanges attribute" (
android:configChanges="orientation|screenSize") in the manifest, the playing of the video will not interrupt which makes the user-experience much better. I have tested this successfully using only the "configChanges attribute" in the manifest and it works fine.
However, there may be reasons (for instance for layout-issues) where it would be also useful to intercept the configuration-change and to do that I would need to be able to use "onConfigurationChanged". In java-code it could be:
I had a play with the JavaObject library and CreateEvent but couldn't get it right.
Could someone help and show how to implement onConfigurationChanged in B4A?
Thanks.
However, sometimes its usage can be justified, for instance when using VideoView and an orientation change takes place. In this case, using the "configChanges attribute" (
android:configChanges="orientation|screenSize") in the manifest, the playing of the video will not interrupt which makes the user-experience much better. I have tested this successfully using only the "configChanges attribute" in the manifest and it works fine.
However, there may be reasons (for instance for layout-issues) where it would be also useful to intercept the configuration-change and to do that I would need to be able to use "onConfigurationChanged". In java-code it could be:
B4X:
@Override
public void onConfigurationChanged(Configuration newConfig) {
if (!AndroidUtil.isHoneycombOrLater())
//some method - changeSurfaceLayout();
super.onConfigurationChanged(newConfig);
//some method - resetHudLayout();
}
I had a play with the JavaObject library and CreateEvent but couldn't get it right.
Could someone help and show how to implement onConfigurationChanged in B4A?
Thanks.