diff --git a/doc/ReleaseNotes/_ReleaseNotes.md b/doc/ReleaseNotes/_ReleaseNotes.md index 9ea1796fa98b..27816bf9428b 100644 --- a/doc/ReleaseNotes/_ReleaseNotes.md +++ b/doc/ReleaseNotes/_ReleaseNotes.md @@ -120,6 +120,7 @@ * [iOS(iPad)] `ComboBox` : the combobox wasn't fully expanding vertically on first opening. * `Popup` & `ComboBox` (and other controls using `Popup`) were not behaving properly when `IsLightDismissable` were set to `true`. * [Wasm] Fix unloaded UIElements are made visible if measured and arranged +* [Android] Fix java NRE handing touch events on detached view ## Release 1.45.0 ### Features diff --git a/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java b/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java index 2d9a7780b8c8..de98faee9e21 100644 --- a/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java +++ b/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java @@ -951,14 +951,19 @@ private static float[] getTransformedTouchCoordinate(ViewParent view, MotionEven return point; } - // Non-UIElement view, walk the tree up to the next UIElement - // (and adjust coordinate for each layer to include its location, i.e. Top, Left, etc.) - final ViewParent parent = view.getParent(); - if (parent instanceof View) { - // Not at root, walk upward - float[] coords = getTransformedTouchCoordinate(parent, e); - calculateTransformedPoint((View) view, coords); - return coords; + if(view != null) { + // The parent view may be null if the touched item is being removed + // from the tree while being touched. + + // Non-UIElement view, walk the tree up to the next UIElement + // (and adjust coordinate for each layer to include its location, i.e. Top, Left, etc.) + final ViewParent parent = view.getParent(); + if (parent instanceof View) { + // Not at root, walk upward + float[] coords = getTransformedTouchCoordinate(parent, e); + calculateTransformedPoint((View) view, coords); + return coords; + } } // We reached the top of the tree