Android: Create a gesture gesture programmatically

I tried to find the answer to this particular case on Google and, strangely enough, could not find it anywhere (there are just answers about finding, not creating, checking). I want to actually “run” the simulated scrolling from right to left on the screen (no matter where, but ideally from the right edge to the left). I tried something like this, but I have NPE:

final float viewWidth = view.getWidth();
    TouchUtils.drag(null,viewWidth,1f,0f,0f,1);

Cause? I need to get the next page to scroll in an infinite viewpager that does not have a real link to the page position (so I can’t just use setCurrentItem).

Any ideas?

+4
source share

All Articles