Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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;
- }
- };
Add Comment
Please, Sign In to add comment