0

I'm writing a simple chat application but i don't know how to use my main result handler from another activity. I'm setting resultHandler in main activity like this:

ResultHandler handler = new ResultHandler();
MGey.setUpdatesHandler(handler);

My ResultHandler.java has this code

public class ResultHandler {
    @Override
    public void onResult(ChatObject object)
    {
        //receive message object from server
    }
}

Now in my other activity (Dialogs.java) I want to use this handler to get updates.

For example: if my onResult method receive new message object (ChatObject.NewMessage) I want to use this object in my Dialogs.java for new message notification etc.

if (object instanceof ChatObject.NewMessage)
//pass this object to Dialogs activity
Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
Bobby Redjeans
  • 575
  • 1
  • 4
  • 18
  • possible duplicate of [How to send an object from one Android Activity to another using Intents?](http://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents) – Ken Y-N Jul 28 '15 at 01:48
  • I can't send chatobject using intents because this is not serialized – Bobby Redjeans Jul 28 '15 at 09:47

0 Answers0