I am creating an android application using smack and openfire in android.I have used a listener for user presences changes.. Below is my code..
toolbar_status=(TextView)findViewById(R.id.toolbar_status) ;
roster.addRosterListener(new RosterListener() {
@Override
public void entriesAdded(Collection<String> addresses) {
}
@Override
public void entriesUpdated(Collection<String> addresses) {
}
@Override
public void entriesDeleted(Collection<String> addresses) {
}
@Override
public void presenceChanged(Presence presence) {
Log.wtf("CRA","Presence changes---------------");
Log.wtf("CRA","new presence is : "+presence.getFrom()+" "+presence.isAvailable());
toolbar_status.setText(setStatus(presence.isAvailable()));
}
});
As you can see i am updating the textview named as toolbar_status with current value... The problem presenceChanged function is called and even Logs are also displayed but the current value is not updated at run time.The value is set to text view when i reopens the activity.. That is,inside presenceChanged function i cannot interact with UI at run time.. I am a beginner in android.Please help me where am i wrong how can i sort it out..