Skip to content

Instantly share code, notes, and snippets.

@moea
Created April 3, 2013 13:16
Show Gist options
  • Save moea/5301114 to your computer and use it in GitHub Desktop.
Save moea/5301114 to your computer and use it in GitHub Desktop.
import android.os.Handler;
import android.os.Message;
public class MessageListenerHandler extends Handler {
private final IMessageListener messageListener;
private final String payloadKey;
public MessageListenerHandler(IMessageListener messageListener, String payloadKey) {
this.messageListener = messageListener;
this.payloadKey = payloadKey;
}
@Override
public void handleMessage(Message msg) {
messageListener.messageReceived(msg.getData().getString(payloadKey));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment