Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 9
Registered: ‎03-11-2009
My Device: Not Specified

Detecting end of scrolling (touch gesture) on GridFieldManager

Hi,

I have a GridFieldManager, which has a bunch of BitmapFields inside it. say 100rows resulting in a virtural height of say 3000px.

 

On the touch device like storm, when I scroll, all the cells/rows in the grid scroll up/down.

When a fast gesture is made the scrolling happens rapidly. I would like to determine when the scrolling is over or ended. Once end of scrolling is detected, I would like to find out the what area of the gridFieldManager is getting shown on the screen.

 

I have tried setting up a scrollChangeListener.

 public void scrollChanged(Manager mgr, int newX, int newY) fn is getting hit till the time the scolling is happening giving me new values of newY. When scrolling happens rapidly, this fn gets called 15-20times. I would like to find out a way when this function is called the last time ?

 

I did see

http://208.74.204.192/t5/Java-Development/How-to-detect-Stop-scrolling/m-p/289884#M49878

but i dont want to do timer thread to keep running all the time when the screen is invoked.

 

Please do help.

 

New Developer
Posts: 9
Registered: ‎03-11-2009
My Device: Not Specified

Re: Detecting end of scrolling (touch gesture) on GridFieldManager

anyone ?

Highlighted
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Detecting end of scrolling (touch gesture) on GridFieldManager

The best I could come up with when I faced this problem was to have some countdown process where the counter resets on each scrollChanged().  When it reaches zero, I declare the scrolling stopped and check the scroll position. I decided that 500 ms after the last scrollChanged() was a good enough indication.

 

Since I already have a repeatedly running TimerTask managing the screen transitions, this was an easy task for me to add. If you don't have anything like that yet you might consider firing a one-time delayed action which is cancelled and rescheduled on each scrollChanged().  Just don't create a new Timer each time - use the same one (maybe pre-create it and have it in some static member) and schedule new TimerTasks whenever they are needed.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!