コード例 #1
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   unbindService(serviceConnection);
   myBinder.shutDown();
   unregisterReceiver(mSongReceiver);
 }
コード例 #2
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.play: // 播放暂停按钮
       if (v.getTag().equals("true")) {
         myBinder.resume();
         v.setTag("false");
       } else {
         myBinder.pause();
         v.setTag("true");
       }
       String data = (String) v.getTag();
       new ClientThread(this, mIpAddress, "playOrpause", data).start();
       break;
     case R.id.next: // 下一首
       myBinder.toNext();
       new ClientThread(this, mIpAddress, "next", null).start();
       break;
     case R.id.prev: // 上一首
       myBinder.toPrev();
       new ClientThread(this, mIpAddress, "prev", null).start();
       break;
   }
 }