Hello All,
I am facing an strange problem,What I am doing that I am removing the topmostChild from a relative layout and assigning some other child to the same position.It's working fine for the very first time but for the second time it's throwing exception
md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
Below is my code:
void framePanned(object sender,MR.Gestures.PanEventArgs e)
{
if (removeFingerposition.X > 10) {
topFrameValue.TranslationX = 0;
bottomFrameValue.TranslationX = 0;
middleFrameValue.TranslationX = 0;
topFrameValue.RotationX = bottomFrameValue.RotationX;
topFrameValue.RotationY = bottomFrameValue.RotationY;
bottomFrameValue.RotationX = middleFrameValue.RotationX;
bottomFrameValue.RotationY = middleFrameValue.RotationY;
middleFrameValue.RotationX = topRotationX;
middleFrameValue.RotationY = topRotationY;
//Throwing Exception for the second time when it's trying to remove the 3rd child(i.e child at index 2)
r.Children.RemoveAt(2);
newframe = new MR.Gestures.Frame ();
newframe.BackgroundColor = currentTopFrameValue.BackgroundColor;
topFramecontainer.Content = newframe;
r.Children.Insert (0, topFramecontainer);
r.Children.Insert (1, bottomFrameValue);
r.Children.Insert (2, middleFrameValue);
frameNumber=0;
this.Content = r;
r.RotateXTo (-360, 300, Easing.CubicIn);
r.RotateYTo (360, 300, Easing.CubicIn);
}