You could try by inserting the following attribute in the manifest:
SetActivityAttribute(Main, android:configChanges, "orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation")
Above attribute will make the code skip the onCreate method upon orientation-change.
If you need to detect when an orientation change takes place you could try out the following code:
Sub Activity_ConfigChanged()
'****************************************************************************************
'This event detects a configuration-change
'****************************************************************************************
Log("inside configsub")
End Sub
#if JAVA
//This java-code will detect a configuration-change. We use it to trigger our event
//Activity_ConfigChanged in our B4A-code.
import android.content.res.Configuration;
import anywheresoftware.b4a.keywords.Common;
import android.view.WindowManager;
import android.content.Context;
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
processBA.raiseEvent(null, "activity_configchanged"); // trigger event in B4A-code
}
#end if
You can check
this project for some more information