Page 1 of 1

IllegalArgumentException in Android

Posted: Thu May 10, 2012 9:18 am
by 17061873
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:

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());
		}
	}
});
Thanks,
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)

Re: IllegalArgumentException in Android

Posted: Fri May 11, 2012 3:24 pm
by yeray
Hi Meir,
investsoft wrote: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).
I'm not able to reproduce it with the app downloaded from the play store and my Galaxy Mini. Maybe my screen is too small. In what device(s) have you tried it? If more than one, did you reproduce the problem in all of them?

Re: IllegalArgumentException in Android

Posted: Wed May 16, 2012 7:42 am
by 17061873
Hi Yeray,
I did try this on more then one device.
It was reproduced on 2 out of 6 devices. In these 2 devices it will happen every time I try.

Reproduced on (and reports were sent to you):
Samsung Nexus S (small screen).
Motorola Xoom (tablet).

Did not happen on:
Samsung Galaxy S2.
Sony Ericsson Xperia LT18i.
Samsung tablet GT-P7510.
Asus Transformer Prime TF201.

I will love to know of any thing you find.
Thanks,
Meir

Re: IllegalArgumentException in Android

Posted: Thu May 17, 2012 3:36 pm
by yeray
Hi Meir,

We haven't been able to reproduce the problem so far.
We'll try it with as many devices as possible, but it would be helpful if you could precise a little bit more:
- Does it happen in one concrete example?
- Do you/we need to touch the screen just a moment or should we push some time, move the palm of the hand around the screen, or some other special movement?
- What Android versions do your devices run?

Thanks in advance.

Re: IllegalArgumentException in Android

Posted: Fri Nov 15, 2013 9:28 am
by narcis
Hi Meir,

Another customer came up with some more information about this issue, see this thread. We haven't been able to reproduce the problem ourselves yet. However, I have submitted the issue (ID103) to our bug tracking platform. If you sign up to it please let us know, we will be glad to add you to the CC List so that you can be notified about updates on the issue.