Last active
December 12, 2015 08:09
-
-
Save nalitzis/4742111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class IncomingHandler extends Handler{ | |
public void handleMessage(Message msg){ | |
Bundle data = msg.getData(); | |
String title = data.getString("TITLE"); | |
int pid = Process.myPid(); | |
Toast.makeText(getApplicationContext(), title + "\nservice pid: "+pid, Toast.LENGTH_SHORT).show(); | |
} | |
} | |
private final Messenger messenger = new Messenger(new IncomingHandler()); | |
//the IBinder returned here is used by the messenger to communicate with the associated handler | |
@Override | |
public IBinder onBind(Intent arg0) { | |
return messenger.getBinder(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment