You cannot call oncreate when converting an android screen.
When the screen of the Android device is automatically rotated horizontally and vertically, the oncreate function will be called again each time for initialization. If the loading data volume is slightly larger, it will take a long time and the user experience is poor, in fact, you can configure the androidmanifest file to change the execution process of the program, so as to avoid multiple calls of the oncreate function during screen rotation.
1. Modify the androidmanifest. xml file and add parameters under the activity Tag:
<Activity Android: Name = "myactivity" </P> <p> Android: configchanges = "orientation | keyboardhidden"> </P> <p>
2. In myactivity, The onconfigurationchanged method is reloaded (automatically called each time the screen is switched) to initialize different Display Interfaces in the horizontal and vertical directions and initialize other data:
@ Override </P> <p> Public void onconfigurationchanged (configuration newconfig) {</P> <p> super. onconfigurationchanged (newconfig); </P> <p>/* </P> <p> If (this. getresources (). getconfiguration (). orientation = configuration. orientation_landscape) {</P> <p> // Add the code to be processed by the landscape </P> <p>} else if (this. getresources (). getconfiguration (). orientation = configuration. orientation_portrait) {</P> <p> // Add the code to be processed by the portrait screen </P> <p >}</P> <p> */</P> <p >}</P> <p>