Hi,

Use a queue or buffer your packets and send ui updates asynchronously.
Is the Packetlistener actually running in a non ui thread ? I don't
think you have not provided enough of your code to be able to say if
it is Thread safe or not.

Regards

On Jul 14, 4:18 am, tuxfusion <[email protected]> wrote:
> I'm attaching a standard Packetlistener to my activity, from within I
> update my UI ( let's say I just change the color of button) like so :
>
>         class ActionPackListener implements PacketListener {
>                         @Override
>                         public void processPacket(Packet packet) {
>
>                                         runOnUiThread(new Runnable() {
>                                             public void run() {
>
>                                                 mybutton.setContent(...
>                                                 
> mybutton.setText(Integer.toString(....
>
> mybutton.setBackgroundColor(Color.RED);
>
> mybutton.setTextSize(11);
>                                             }
>
>                                         });
>             ...
>
> Now from another client I send around 40 IQ packets to the above
> client , when I include a sleep of 1 sec to the sending everything is
> okay ( not always but in about 75 % still not good )until I interfere
> with the gui of the receiver while it still gets packets. It does
> receive the package however the update of the UI is dropped. Even
> worse , if I start sending those 40 IQ from the receiver to the sender
> via a function , UI update comes to a complete hold . What am I doing
> wrong / have to implement to make the UI always be able to update
> correctly no matter how many requests it get's and it what speed? From
> my understanding and what I read on android.com 
> ,http://developer.android.com/guide/topics/fundamentals/processes-and-...
> ,  the above example is thread save, no ? How can i debugg this
> problem ?

-- 
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