IllegalArgumentException in Android
Posted: Thu May 10, 2012 9:18 am
Hi.
I have noticed a strange behavior of the chart on Android app.
When touching the chart with the palm of my hand I get a force close dialog because of an IllegalArgumentException.
I was able to reproduce this behavior on your example app that I downloaded from the Google Play store (I sent a report).
What is the cause for this? Is it going to be fixed, or is there a good workaround for this?
Meanwhile I have set a touch listener that passes the call to the chart's onTouch() and surrounded that call with try/catch:
Thanks,
Meir, Investsoft
Exception message:
I have noticed a strange behavior of the chart on Android app.
When touching the chart with the palm of my hand I get a force close dialog because of an IllegalArgumentException.
I was able to reproduce this behavior on your example app that I downloaded from the Google Play store (I sent a report).
What is the cause for this? Is it going to be fixed, or is there a good workaround for this?
Meanwhile I have set a touch listener that passes the call to the chart's onTouch() and surrounded that call with try/catch:
Code: Select all
chart.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
try {
// IllegalArgumentException thrown here when touching the chart with the palm of the hand
// surrounding it with try/catch so the app doesn't crash...
chart.onTouch(v,event);
} catch (IllegalArgumentException e) {
Log.e(TAG, e.printStackTrace());
}
}
});
Meir, Investsoft
Exception message:
historyPos out of range. Stack trace: java.lang.IllegalArgumentException: historyPos out of range
at android.view.MotionEvent.nativeGetAxisValue(Native Method)
at android.view.MotionEvent.getHistoricalX(MotionEvent.java:2268)
at com.steema.teechart.TChart.onTouch(TChart.java:1119)
at android.view.View.dispatchTouchEvent(View.java:5536)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
at android.view.View.dispatchPointerEvent(View.java:5721)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:859)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)