I added a short delay to the update message and cancel any pending
updates before creating a new one and that seems to help with the
animation issues.

So call Handler.removeMessages and use sendMessageDelayed instead of
sendMessage


On Feb 17, 8:20 pm, Dewr <[email protected]> wrote:
> Hi Richard. Have you solved this problem?
> I am getting pain from same problem. :(
> But I have seen an app works well smoothly. the name of it is '예스24'.
>
> On 1/13/11, Richard Schilling <[email protected]> wrote:
>
>
>
>
>
>
>
> > I have a gallery on my screen.  Works great and scrolls smoothly ...
> > until I set the OnItemSelectedListener.  When I do, Gallery gets
> > really "jerkey".  It seems to stick.  I think I know why, but I was
> > wondering if others have found a better solution they would be willing
> > to share.  Here's my onItemSelectedListener:
>
> >            myGallery.setOnItemSelectedListener(new OnItemSelectedListener(){
> >                    @Override
> >                    public void onItemSelected(AdapterView<?> parent, View 
> > view,
> >                                    int position, long id) {
> >                            // do nothing on purpose to see what the effect 
> > is
> >                            if (view == null)
> >                                    return;
>
> >                            Message msg = Message.obtain();
> >                            msg.obj = view.getTag();
> >                            _handler.sendMessage(msg);
>
> >                    }
> >                }});
>
> > And here is the handler:
>
> >    private Handler _handler = new Handler(){
> >            public void handleMessage(Message msg){
>
> >                    if (msg.obj != null && msg.obj instanceof String){
>
> >                            textView1.setText(msg.toString());
> >                            textView2.setText(msg.toString().length();
> >                    }
> >            }
> >    };
>
> > When the UI thread updates the controls with the data, it seems to
> > interrupt the scrolling of the gallery itself and causes the gallery
> > to not scroll smoothly.  Commenting out the handler code eliminates
> > the problem.
>
> > So, I know the problem has to do with the fact that the UI just can't
> > update the text controls and keep the gallery scrolling smoothly at
> > the same time.
>
> > Does anyone have a work around for this problem?
>
> > Thanks in advance!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to