@Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // menu item selected
   switch (item.getItemId()) {
     case R.id.action_shuffle:
       musicSrv.setShuffle();
       break;
     case R.id.action_end:
       stopService(playIntent);
       musicSrv = null;
       System.exit(0);
       break;
   }
   return super.onOptionsItemSelected(item);
 }
Esempio n. 2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.about:
        Toast.makeText(getApplicationContext(), "Music Player", Toast.LENGTH_SHORT).show();
        break;
      case R.id.exit:
        stopService(playIntent);
        musicService = null;
        System.exit(1);
        break;

      case R.id.action_shuffle:
        musicService.setShuffle();
        Toast.makeText(getApplicationContext(), "Shuffle", Toast.LENGTH_SHORT).show();
        break;
    }
    return super.onOptionsItemSelected(item);
  }