update UI in EventAction callback function

Hi, I am new to the Android client programming in photon, and I met a basic problem. I implements the IPhotonPeerListener in the Activity, and in the callback function EventAction, I added some code to update the Activity UI component, by which I think the UI should update once the client receives the message from the server.
public void eventAction(byte eventCode, Hashtable<Byte, Object> ev) {
        ......
case EV_BROADCAST:
	evData = (Hashtable<Object, Object>) ev.get(LiteEventKey.Data.value());

	int srcPlayer = (Integer) ev.get(LiteEventKey.ActorNr.value());
	String msg = (String) evData.get((byte) 1);

	chatBoard.setText("testtest"+msg);
        Toast.makeText(photonClient.this, "msg="+msg, Toast.LENGTH_SHORT).show();

	Log.i("photonClient","player("+srcPlayer+")said:"+msg);
        ......
}
The code above deal with the message once other client sends a broadcast message. From the Logcat I found that the code is executed, but neither the chatBoard (an instance of TextView) nor the Toast seem to affect. The text in TextView remains no change, and no float bubble appeared.

Why the callback function can't update the Activity UI? Anybody knows?

Thanks!!
Sign In or Register to comment.