stride3d/stride · error · Exception
Internal error: Can not activate edit text, another edit…
Error message
Internal error: Can not activate edit text, another edit text is already active
What it means
This error is thrown by Stride.UI's Android EditText backing store when a second native edit text is about to be activated while one is already active. The class keeps a single static/active native EditText popup per process, so only one control may hold it at a time. It signals an internal state-machine violation in UI focus management rather than a caller mistake.
Solutions
- Ensure the currently active EditText is deactivated (focus lost / selection cleared) before activating another one
- Only programmatically activate an EditText when IsSelectionActive is false
- Check for leaked activation: if the first EditText was removed from the tree while active, deactivate or dispose it first
- Reproduce with a minimal two-EditText focus script and report as a Stride bug if the framework leaves activeEditText set
Example fix
// before editTextA.ActivateFocus(); editTextB.ActivateFocus(); // throws: A still active // after editTextA.DeactivateFocus(); // or move focus away first editTextB.ActivateFocus();
Defensive patterns
Strategy: try-catch
Validate before calling
if (activeEditText != null && activeEditText != myEditText)
activeEditText.DeactivateFocus(); // release native popup first Type guard
bool CanActivate(EditText e) => e != null && !e.IsSelectionActive;
Try / catch
try
{
editText.ActivateFocus();
}
catch (Exception ex) when (ex.Message.Contains("another edit text is already active"))
{
// deactivate the other EditText and retry once, or log a focus-management bug
} Prevention
- Never activate two EditTexts concurrently; route all programmatic focus through one helper
- Deactivate/dispose removed EditTexts to avoid leaked activations
- In tests, reset focus state between cases
When it happens
Trigger: Calling ActivateEditTextImpl (directly or via focus/selection APIs such as IsSelectionActive touching selection activation) while activeEditText is already set to another control; activating two EditTexts without deactivating the first; a prior EditText failing to release the native popup during deactivation.
Common situations: Programmatically focusing a second text input while a first still has focus on Android; UI layouts where focus transitions skip the deactivate step; headless or automated test harnesses where native popup teardown behaves differently.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- A routed event named
- AHardwareBuffer import requires…
- Can only assign UIElementService to the root element!
- Cannot add a null UIElement to the children list.
- Element is not a child of this element.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/65c9235df527a0ca.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.UI/Controls/EditText.Android.cs:240
return;
editText.Post(editTextSetMaxLinesAction);
}
private void OnMinLinesChangedImpl()
{
if (editText == null)
return;
editText.Post(editTextSetMinLinesAction);
}
private void ActivateEditTextImpl(InputManager inputManager)
{
lock (syncRoot)
{
if (activeEditText is not null)
throw new Exception("Internal error: Can not activate edit text, another edit text is already active");
EnsureStaticEditText();
if (staticEditText is null)
return; // headless test environment — no native popup means no activation
activeEditText = this;
// Select all text on initial focus.
// TODO: Maybe make it configurable on how caret/selection should default on activation?
SelectAll();
// Note that we do not assign 'staticEditText' to 'editText' until the Post action
// is actually invoked to ensure the control is fully ready
staticEditText.Post(editTextSetActivatedStateAction);
GetGameContext()?.ShowEditTextPopup();
}
}
View on GitHub (pinned to 96fad776d2)