I have used CCTableView , but when i tested it on android “tableCellTouched” method never called when i try to touch on the cell, instead the table drags/scrolls little bit.
When i use ccTouchBegan , ccTouchMoved , ccTouchEnded just one tap calls all the three methods but ccTouchMoved should not be called.
recreating issue 1 :
create a table view and try to detect tap on every cell, the table will scroll little bit or sometimes “tableCellTouched” is called.
tested on : Samsung S3, HCL ME Tablet, Samsung Note.
recreating issue 2 :
try to detect single tap on the layer , just a little touch on the layer without dragging your finger , the ccTouchMoved will also called.
Possible problem :
The touch sensitivity of the high end devices in android is very sensitive.
I am thankful to you , you have taken interest in this bug , it is not bug that cocos2dx framework is producing it is fault of over sensitive touch screens,
I have two solutions but i do not think they could be perfect ,
as on devices which have sensitive touch screens. There should be a threshold is terms of dragging or time. I mean to say if user touches screen to do a TAP the framework detect it as drag because of the sensitive screen, so if there is threshold of 10-15 DPI with coordination with time between onTouchBegan and onTouchMoved , onTouchEnded or with standard delegate onTouchesBegan, onTouchesMoved, onTouchesEnded the will understand if user is only tapping or doing other gestures. The problem with this solution is it will behave wired on the normal device or on apple devices.
another solution can be if sensitivity of the phone is lowered. The problem with this solution is i can’t find any way to lower the sensitivity of the device.
Another thing i need to mention CCMenu is behaving perfectly on the sensitive devices.
i am sorry for my bad english that is my suggestion,
to came up this problem CCScrollView has to be modified, i have modified it but not giving me acceptable results , the touch methods in CCScrollView.cpp ,
in ccTouchBegin record touchPoint ,
in ccTouchMoved record touchPoint in different variable ,
in ccTouchEnded , if difference between two points is < ccp(5,5) then cell should be selected, otherwise it is a normal scrolling.
Do we need to consider the DPI for different devices? High DPI device might use long distance which more than ccp(5, 5). However the current cocos2d-x api doesn’t contain the function to get device DPI.
Nitesh Purohit wrote:
to came up this problem CCScrollView has to be modified, i have modified it but not giving me acceptable results , the touch methods in CCScrollView.cpp ,
>
in ccTouchBegin record touchPoint ,
in ccTouchMoved record touchPoint in different variable ,
in ccTouchEnded , if difference between two points is < ccp(5,5) then cell should be selected, otherwise it is a normal scrolling.
>
hope it helps,
Nitesh
even android SDK donot have any function to return value related to DPI. We need to calculate it. I can across of some formulas
Density=Square root((wp*wp)+(hp*hp))/di
where wp is width resolution in pixels, hp is height resolution in pixels and di is diagonal size in inches.
other one is
// The gesture threshold expressed in dp
private static final float GESTURE_THRESHOLD_DP = 16.0f;
// Get the screen’s density scale
final float scale = getResources().getDisplayMetrics().density;
// Convert the dps to pixels, based on density scale
mGestureThreshold = (int) (GESTURE_THRESHOLD_DP * scale + 0.5f);
i have not found anything promising enough to resolve this issue. It around 2 month i have posted this issue with tableview, i managed my view without tableview, but with due respect it is an important improvement tobe done.
I can confirm these problems also appear on HTC Desire S. It works a bit better on Nexus 7, however on some occasions a touch is also detected as a scroll.
Please fix this issue.
@Nitesh Purohit
Issue #1672 was created for this bug. I will try to fix it. Thanks.
Nitesh Purohit wrote:
i have not found anything promising enough to resolve this issue. It around 2 month i have posted this issue with tableview, i managed my view without tableview, but with due respect it is an important improvement tobe done.
>
Regards,
Nitesh Purohit
I come across with the same problemCan you tell me how to solve this problem?
Thanks!
James Chen wrote:
@Nitesh Purohit
Issue #1672 was created for this bug. I will try to fix it. Thanks.
>
Nitesh Purohit wrote:
> i have not found anything promising enough to resolve this issue. It around 2 month i have posted this issue with tableview, i managed my view without tableview, but with due respect it is an important improvement tobe done.
>
> Regards,
> Nitesh Purohit
I come across with the same problemCan you tell me how to solve this problem?
Thanks!
James Chen wrote:
> @Nitesh Purohit
> Issue #1672 was created for this bug. I will try to fix it. Thanks.
>
> Nitesh Purohit wrote:
> > i have not found anything promising enough to resolve this issue. It around 2 month i have posted this issue with tableview, i managed my view without tableview, but with due respect it is an important improvement tobe done.
> >
> > Regards,
> > Nitesh Purohit
The latest codes on the github have resolved the issue.
CCScrollview will not deal with sensitive moving as a move action.
Please see the codes below:
[…]
Zhiqiang Li wrote:
I come across with the same problem)![](Can you tell me how to solve this problem?
Thanks)
> James Chen wrote:
> > @Nitesh Purohit
> > Issue #1672 was created for this bug. I will try to fix it. Thanks.
> >
> > Nitesh Purohit wrote:
> > > i have not found anything promising enough to resolve this issue. It around 2 month i have posted this issue with tableview, i managed my view without tableview, but with due respect it is an important improvement tobe done.
> > >
> > > Regards,
> > > Nitesh Purohit
I according to this(https://github.com/dumganhar/cocos2d-x/commit/7743f0778a59a67ec6ca16530e57496d424b47ad) to change
But why Android appear the following error
@
02-25 17:47:49.369: E/AndroidRuntime(22468): FATAL EXCEPTION: GLThread 10
02-25 17:47:49.369: E/AndroidRuntime(22468): java.lang.NoSuchMethodError: getDPI
02-25 17:47:49.369: E/AndroidRuntime(22468): at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesMove(Native Method)
02-25 17:47:49.369: E/AndroidRuntime(22468): at org.cocos2dx.lib.Cocos2dxRenderer.handleActionMove(Cocos2dxRenderer.java:128)
02-25 17:47:49.369: E/AndroidRuntime(22468): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$6.run(Cocos2dxGLSurfaceView.java:217)
02-25 17:47:49.369: E/AndroidRuntime(22468): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1346)
02-25 17:47:49.369: E/AndroidRuntime(22468): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
@
Because of didn’t wrote native method name?
James Chen wrote: