I'm trying to load a Layout in a library to a panel. This is the code:
This works very well in release mode. In Debug mode the app just closes without any notice.
The unfiltered logs show the following:
Can I make this work in debug mode?
I have to use ViewTreeObserver because only at the onGlobalLayout event the correct sizes of the Panel are known.
B4X:
@BA.RaisesSynchronousEvents
public MaterialDialogBuilderWrapper CustomView2(final String B4ALayout, final boolean WrapInScrollView, int Height) {
final PanelWrapper panel = new PanelWrapper();
panel.Initialize(mBa, "");
mCustomViewHeight = Height;
mBuilder.customView(panel.getObject(), WrapInScrollView);
ViewTreeObserver viewTreeObserver = panel.getObject().getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
panel.getObject().getViewTreeObserver().removeGlobalOnLayoutListener(this);
panel.setHeight(panel.getObject().getMeasuredHeight());
panel.setWidth(panel.getObject().getMeasuredWidth());
try {
panel.LoadLayout(B4ALayout, mBa);
} catch (Exception e) {
e.printStackTrace();
BA.Log("Unable to load Layout");
}
MaterialDialogWrapper dialog = new MaterialDialogWrapper(mDialog, mBa, mEventName);
mBa.raiseEventFromUI(mDialog, mEventName + "_customviewready", dialog, panel);
}
});
}
return this;
}
This works very well in release mode. In Debug mode the app just closes without any notice.
The unfiltered logs show the following:
eglSurfaceAttrib not implemented
Failed to set EGL_SWAP_BEHAVIOR on surface 0xe009a8e0, error=EGL_SUCCESS
-1 received (controller)
Skipped 76 frames! The application may be doing too much work on its main thread.
tid 671: eglCreateSyncKHR(1215): error 0x3004 (EGL_BAD_ATTRIBUTE)
** Activity (main) Pause, UserClosed = true **
Long monitor contention event with owner method=boolean com.android.server.am.ActivityManagerService.finishActivity(android.os.IBinder, int, android.content.Intent, boolean) from ActivityManagerService.java:4245 waiters=0 for 670ms
Long monitor contention event with owner method=boolean com.android.server.am.ActivityManagerService.finishActivity(android.os.IBinder, int, android.content.Intent, boolean) from ActivityManagerService.java:4245 waiters=1 for 725ms
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
channel '5227720 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main (server)' ~ Consumer closed input channel or an error occurred. events=0x9
channel '5227720 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main (server)' ~ Channel is unrecoverably broken and will be disposed!
channel '7232a33 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main (server)' ~ Consumer closed input channel or an error occurred. events=0x9
channel '7232a33 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main (server)' ~ Channel is unrecoverably broken and will be disposed!
Background partial concurrent mark sweep GC freed 16787(1070KB) AllocSpace objects, 6(120KB) LOS objects, 33% free, 8MB/13MB, paused 909us total 113.526ms
Buffer count: 4
WIN DEATH: Window{7232a33 u0 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main}
Attempted to unregister already unregistered input channel '7232a33 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main (server)'
WIN DEATH: Window{5227720 u0 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main}
Attempted to unregister already unregistered input channel '5227720 de.amberhome.materialdialogs.example/de.amberhome.materialdialogs.example.main (server)'
Process de.amberhome.materialdialogs.example (pid 3595) has died
Initialized EGL, version 1.4
eglSurfaceAttrib not implemented
Failed to set EGL_SWAP_BEHAVIOR on surface 0xe05c8260, error=EGL_SUCCESS
Skipped 42 frames! The application may be doing too much work on its main thread.
Got RemoteException sending setActive(false) notification to pid 3595 uid 10065
Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=0 for 202ms
Skipped 41 frames! The application may be doing too much work on its main thread.
Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=0 for 762ms
Long monitor contention event with owner method=java.util.List com.android.server.am.ActivityManagerService.getAllStackInfos() from ActivityManagerService.java:8937 waiters=0 for 938ms
Skipped 93 frames! The application may be doing too much work on its main thread.
0xe0c9f000 Launching thread(s), CPUs 4
Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Failed to dispatch window animation state change.
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Failed to dispatch window animation state change.
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
write blocked for 9850 msecs, 17 delayed writes, thread 0xf1dc0000
Can't parse request
Can't parse request
Can't parse request
Received Set Clipboard
Received Set Clipboard
Received Set Clipboard
Received Set Clipboard
Can I make this work in debug mode?
I have to use ViewTreeObserver because only at the onGlobalLayout event the correct sizes of the Panel are known.