Android: Add QtEditText to QtWindow in constructor
Of course, createSurface() is called more than once, for example when coming back from the background, and you cannot add a View to the layout more than once, since this leads to an uncaught exception and a crash. So add the QtEditText once, in the constructor, as is indeed sensible. Fixes: QTBUG-122648 Pick-to: 6.7 Change-Id: I7ef48951cd8a1c99935f5e96c70b6dbf0c745803 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>bb10
parent
df1efc70b0
commit
211e51b81e
|
|
@ -33,6 +33,8 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||
m_editText = new QtEditText(context, delegate);
|
||||
setParent(parentWindow);
|
||||
setFocusableInTouchMode(true);
|
||||
addView(m_editText, new QtLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
|
||||
QtNative.runAction(() -> {
|
||||
m_gestureDetector =
|
||||
|
|
@ -111,8 +113,6 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||
// The surface container of this window will be added as the first of the stack.
|
||||
// All other views are stacked based on the order they are created.
|
||||
addView(m_surfaceContainer, 0);
|
||||
addView(m_editText, new QtLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue