xamarin-docs
xamarin-docs copied to clipboard
Multi-Touch Effect - Crash on Android Platform
Hello,
Sorry, I'm new to contribute to Xamarin Doc. So I prefer to open an issue and let you check this. Don't hesitate to give my feed back !
I encouter some crashes on Android platform. In some circumstances, the Id already exists in the idToEffectDictionary dictionary while an new Down ou PointerDown event is fired (with the same id than an existing one) ... ! So I add some Key checking before insertion (see bold lines below).
It solves the problem and I didn't see any backside effect up to now. Any better idee or comment ?
case MotionEventActions.Down:
case MotionEventActions.PointerDown:
FireEvent(this, id, TouchActionType.Pressed, screenPointerCoords, true);
// Added by Belight on 2021/11/03
**if (idToEffectDictionary.ContainsKey(id))
idToEffectDictionary[id] = this;
else**
// End of addition
idToEffectDictionary.Add(id, this); // Memorises the id of the touch within the effect who "receive" it
capture = libTouchEffect.Capture;
break;
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 908530d1-f21d-5532-c530-1727e3356b64
- Version Independent ID: e01f2543-3b7d-0b60-8d79-c012feab83de
- Content: Invoking Events from Effects - Xamarin
- Content Source: docs/xamarin-forms/app-fundamentals/effects/touch-tracking.md
- Product: xamarin
- Technology: xamarin-forms
- GitHub Login: @davidbritch
- Microsoft Alias: dabritch