Created
October 10, 2010 00:32
-
-
Save pbrisbin/618766 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
| // establish the connection | |
| private void connectToService() { | |
| try { | |
| bindService(new Intent(this, StreamMusic.class), onService, BIND_AUTO_CREATE); | |
| } | |
| catch (Exception e) { | |
| Log.e(APP, "error binding to service.", e); | |
| } | |
| } | |
| // once connected, set up the interface object | |
| private ServiceConnection onService = new ServiceConnection() { | |
| public void onServiceConnected(ComponentName className, IBinder iBinder) { | |
| streamMusic = ((StreamMusic.LocalBinder)iBinder).getService(); | |
| } | |
| public void onServiceDisconnected(ComponentName className) { | |
| streamMusic = null; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment