@@ -155,21 +155,22 @@ public class @SYS_APPNAME@ extends Activity implements @ANDROID_JAVA_IMPLEMENTS@
155155
156156 @ Override
157157 public void setContentView (android .view .View view ) {
158- if (current_ContentView != view ) {
159- // Note: this is a bit brain dead as it ONLY handles GLSurfaceView
160- if (current_ContentView instanceof android .opengl .GLSurfaceView ) {
161- ((android .opengl .GLSurfaceView )current_ContentView ).onPause ();
162- }
163- android .view .ViewParent parent0 = view .getParent ();
164- if (parent0 instanceof android .view .ViewGroup ) {
165- android .view .ViewGroup parent = (android .view .ViewGroup ) parent0 ;
166- if (parent !=null ) {
167- parent .removeView (current_ContentView );
168- }
158+ if (current_ContentView instanceof android .opengl .GLSurfaceView ) {
159+ ((android .opengl .GLSurfaceView )current_ContentView ).onPause ();
160+ }
161+ android .view .ViewParent parent0 = view .getParent ();
162+ if (parent0 instanceof android .view .ViewGroup ) {
163+ android .view .ViewGroup parent = (android .view .ViewGroup ) parent0 ;
164+ if (parent !=null ) {
165+ parent .removeView (current_ContentView );
169166 }
167+ } else if (parent0 != null ) {
168+ System .err .println ("setContentView view " + view + " has unhandled parent " + parent0 );
169+ } else {
170170 current_ContentView = view ;
171+ super .setContentView (current_ContentView );
171172 }
172- super . setContentView ( current_ContentView );
173+ // TBD: chances are that other classes might need a resume call too.
173174 if (current_ContentView instanceof android .opengl .GLSurfaceView ) {
174175 ((android .opengl .GLSurfaceView )current_ContentView ).onResume ();
175176 }
@@ -212,9 +213,6 @@ public class @SYS_APPNAME@ extends Activity implements @ANDROID_JAVA_IMPLEMENTS@
212213 // Additions needed by modules, e.g. gps
213214 @ ANDROID_JAVA_ONCREATE @
214215
215- // MUST NOT run before nativeInstanceInit completed
216- // and MUST NOT run before permission checks
217- setContentView (current_ContentView ==null ? mGLView : current_ContentView );
218216 // start EVENT_IDLE
219217 if (idle_tmScheduleRate > 0 ) idle_tm .scheduleAtFixedRate (idle_task , 0 , idle_tmScheduleRate );
220218 }
0 commit comments