* Skip the gesture detector, just handle the touch events yourself
* Do not create a new bitmap. Load it once and blt from it to the surface
* Background thread should wait on some object to be notified by UI thread
when new x/y scroll is available, then draw
We use this approach in PhoneMyPC and have very responsive scrolling of
quite large images.
Scott
SoftwareForMe.com
On Thu, Nov 12, 2009 at 7:58 AM, Genc wrote:
> Hi all,
>
> For a project, I'm displaying an image with sizes 800 x 600 and I've
> implemented my custom scrolling (horizontal and vertical) - which is
> works fine. However, my problem is that it's not fast enough. If you
> continuously move your finger on screen for instance, scrolling is not
> responding fast enough. There is a lag and you need to wait (say
> 400-500ms) for new scrolled image to be loaded.
>
> Now below I described how I implemented scrolling and my question is
> that
>
> - How can I make it faster, if possible
> - Is there any other better way to implement this.
>
> Thanks in advance!!
>
>
>
> My custom scrolling solution:
>
> * I have a Main activity, SurfaceView and a thread
> * In main activity, I'm using GestureDetector and override onScroll
> method.
> * In onScroll method of activity, I'm passing values to SurfaceView's
> "handleScrolling" method.
> * In "handleScrolling" method, I'm calculating proper values and using
> "newImage = Bitmap.createBitmap(myImage, starX, stopY, SCREEN_WIDTH,
> SCREEN_HEIGHT)"; to create a new, "scrolled" image.
>
> * Then in thread loop, I'm drawing this "newImage" to canvas.
>
> Hope this much info helps.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Warm regards,
The PhoneMyPC Team
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en