Hi All,

I made a simple android client app containing a UI with a TextView.
>From a server application (that runs on a desktop PC), I am sending
messages over XMPP (using the Smack library) to the android client and
I want to display the content of these messages in the textview. The
messages are received correctly (I checked this using the Log.i()
debug function). However, the textfield only updates when receiving
the first message. When receiving other messages, it remains constant.
The (most relevant) code of my application can you find below.
Hopefully someone can help me out.

Kind regards,

Jan

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        LinearLayout lin = new LinearLayout(this);
        lin.setOrientation(LinearLayout.VERTICAL);
        TextView m_tv = new TextView(this);
        m_tv.setId(1000);
        m_tv.setWidth(250);
        m_tv.setEnabled(true);
        lin.addView(m_tv);

        setContentView(lin);

        //Initialize network service and network callback
}


//Network Callback
public void processMessage(Chat arg0, Message arg1) {
        TextView tv = (TextView)this.findViewById(1000);
        //the next line should update the textfield
        tv.setText(arg1.getBody());
        //the next line shows the message content for debug purposes (and
shows the messages are received correctly)
        Log.i("XMPPCLient", "Got message "+arg1.getBody());
}

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