We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Android app crashes when the user pinches the chart

Hi all,
When a user pinches the graph on my app the app crashes with the following error message:

Java.Lang.ArrayIndexOutOfBoundsExceptionlength=1; index=1


System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualBooleanMethod(JniObjectReferenceinstance, JniObjectReference type, JniMethodInfo method, JniArgumentValue* args)

Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualBooleanMethod(string encodedMember,IJavaPeerable self, JniArgumentValue* parameters)

Android.Views.View.DispatchTouchEvent(MotionEvent e)

Xamarin.Forms.Platform.Android.PlatformRenderer.DispatchTouchEvent(MotionEvent e)

Android.Views.View.n_DispatchTouchEvent_Landroid_view_MotionEvent_(IntPtr jnienv, IntPtrnative__this, IntPtr native_e)

at (wrapper dynamic-method) System.Object:d634eb5f-4c6f-4149-802d-ee8fd45f2a65 (intptr,intptr,intptr)


--- End of managed exception stack trace ---

java.lang.ArrayIndexOutOfBoundsException: length=1; index=1

at android.support.v4.widget.ViewDragHelper.saveLastMotion(ViewDragHelper.java:849)

at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1057)

at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1434)

at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1960)

at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)

at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)

md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_dispatchTouchEvent(Native Method)

at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:55)

at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)

at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)

at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)

at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)

at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)

at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)

at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)

at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)

at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2369)

at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1719)

at android.app.Activity.dispatchTouchEvent(Activity.java:2742)

at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2330)

at android.view.View.dispatchPointerEvent(View.java:8666)

at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4123)

at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3989)

at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)

at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)

at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)

at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3680)

at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)

at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3737)

at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)

at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)

at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)

at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)

at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)

at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5807)

at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5781)

at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5752)

at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5897)

at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)

android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)

at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)

at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5868)

at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5920)

at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)

at android.view.Choreographer.doCallbacks(Choreographer.java:580)

at android.view.Choreographer.doFrame(Choreographer.java:548)

at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:135)

at android.app.ActivityThread.main(ActivityThread.java:5254)

java.lang.reflect.Method.invoke(Native Method)

at java.lang.reflect.Method.invoke(Method.java:372)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)


And here is the XAML:

<chart:SfChartx:Name="Chart"Grid.Column="0"Grid.Row="0">

<chart:SfChart.BindingContext>
<local:BssGraphViewModel/>
</chart:SfChart.BindingContext>

<chart:SfChart.Legend>
<chart:ChartLegend/>
</chart:SfChart.Legend>

<chart:SfChart.ChartBehaviors>
<chart:ChartZoomPanBehaviorEnableZooming="true"EnablePanning="true"EnableDoubleTap="true"EnableSelectionZooming="false"ZoomMode="X"/>
</chart:SfChart.ChartBehaviors>

<chart:SfChart.PrimaryAxis>
<chart:DateTimeAxisShowMajorGridLines="false"RangePadding="Round"EdgeLabelsDrawingMode="Shift"IntervalType="Days"Interval="1">
<chart:DateTimeAxis.Title>
<chart:ChartAxisTitleText="Date"/>
</chart:DateTimeAxis.Title>
<chart:DateTimeAxis.LabelStyle>
<chart:ChartAxisLabelStyleLabelFormat="ddMMMHH:mm"></chart:ChartAxisLabelStyle>
</chart:DateTimeAxis.LabelStyle>
</chart:DateTimeAxis>
</chart:SfChart.PrimaryAxis>

<chart:SfChart.SecondaryAxis>
<chart:NumericalAxisShowMinorGridLines="false"ShowMajorGridLines="true"Maximum="7"Minimum="1"Interval="1"PlotOffset="20">
<chart:NumericalAxis.MajorGridLineStyle>
<chart:ChartLineStyleStrokeDashArray="{StaticResourcestrokeDashArray}"StrokeWidth="2"/>
</chart:NumericalAxis.MajorGridLineStyle>
<chart:NumericalAxis.StripLines>
<chart:NumericalStripLineStart="1"Width="1"Text="Notsogood"FillColor="#99EA594D"/>
<chart:NumericalStripLineStart="2"Width="1"Text="Notbad"FillColor="#99E99040"/>
<chart:NumericalStripLineStart="3"Width="1"Text="Good"FillColor="#994FD480"/>
<chart:NumericalStripLineStart="4"Width="1"Text="Good"FillColor="#994FD480"/>
<chart:NumericalStripLineStart="5"Width="1"Text="Notbad"FillColor="#99E99040"/>
<chart:NumericalStripLineStart="6"Width="1"Text="Notsogood"FillColor="#99EA594D"/>
</chart:NumericalAxis.StripLines>
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>

<chart:SfChart.Series>
<chart:FastLineSeries
ItemsSource="{BindingDataPoints}"
XBindingPath="ChosenDate"
YBindingPath="BssValue"
EnableDataPointSelection="false"
LegendIcon="SeriesType"
Color="#5A5A5A"
Label="stoolquality">
<chart:FastLineSeries.StrokeDashArray>
<x:ArrayType="{x:Typex:Double}">
<x:Double>2</x:Double>
<x:Double>2</x:Double>
</x:Array>
</chart:FastLineSeries.StrokeDashArray>
<chart:FastLineSeries.DataMarker>
<chart:ChartDataMarkerShowLabel="false"ShowMarker="True"MarkerType="Ellipse"MarkerColor="#5A5A5A"MarkerWidth="20"MarkerHeight="20"></chart:ChartDataMarker>
</chart:FastLineSeries.DataMarker>

</chart:FastLineSeries>
</chart:SfChart.Series>
</chart:SfChart>


Any ideas?


Thanks,


David




5 Replies

YP Yuvaraj Palanisamy Syncfusion Team July 26, 2016 11:46 AM UTC

Hi David Conlisk,
 
Thanks for contacting Syncfusion Support
 
We are not able to reproduce the issue at our end and we have prepared a sample with your code.  Please  update us the modified  sample for further assistance on this.
 
Thanks,
Yuvaraj



DC David Conlisk July 29, 2016 07:15 AM UTC

Hi Yuvaraj,

Thanks for the sample, which does work. I compared it with my version and realised the problem is to do with the fact that I'm using a MasterDetailPage in my app. I've updated your simple droid project to place the graph within a MasterDetailPage and it crashes when you pinch. Please see the attached updated project.

Thanks,

David

Attachment: SimpleSample_9b5251b6.zip


MT Mung Tran Van August 1, 2016 06:01 AM UTC

I faced the same issue.

Please share information if you have solution for this.

Thank you,


MT Mung Tran Van August 1, 2016 06:45 AM UTC

Hi Yuvaraj Palanisamy,
In my case, the problem raises only when I enable tooltip of series or chart.
When I remove tooltip, every thing is ok.
Please check it and fingure out.
I hope I can use tooltip in this case too.
Please let me know when you have solution.

Thank you


YP Yuvaraj Palanisamy Syncfusion Team August 2, 2016 12:31 PM UTC

Hi Mung and David,

Thanks for contacting Syncfusion support.

We are able to reproduce the issue at our end and the fix for this issue will be included in our upcoming Volume 2, 2016 service pack 2 release which is scheduled to be released by the end of August, 2016.

Thanks,
Yuvaraj

Loader.
Live Chat Icon For mobile
Up arrow icon