You keep overriding your s variable. You should make the String part of the 
message you send.

On Oct 22, 2008 3:12 PM, "Al_R" <[EMAIL PROTECTED]> wrote:


Hi, I have an app which makes a new server thread. This server thread
connects and parses data received from the irc server and uses a
handler inside the main class to update the textview. The problem I'm
having is most of the times, the message is not seen by the handler. I
know for sure it exists, I can see it in LogCat.

My classes are laid out like this:

class main:

public handler h;
public string s;

oncreate() {

//declare my textview (tv) here
//do the layout and stuff here

Thread t = new Thread(new Server());
t.start();

handler = new handler() {

   @override
    public void handleMessage(Message m) () {
               tv.append(s);
   }
};


Server class:

public void run() {


  //connect to server and set up my buffered read/writer here

  String msg = reader.ReadLine();
  mainClass.s = msg + "\n";
 mainClass.h.sendEmptyMessage(0);
}

I'm not sure why it keeps on missing some messages. Maybe there is a
better way to update the textview?


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