private void finishActivity() {
    dismissProgressDialog();
    if (getRadioChannelTask != null && mIsExecuteGetRadioChannelTask) {
      getRadioChannelTask.cancel(true);
      mIsExecuteGetRadioChannelTask = false;
    }
    getRadioChannelTask = null;

    finish();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) {
      this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }

    mSettingsContentObserver = new SettingsContentObserver(this, new Handler());
    getApplicationContext()
        .getContentResolver()
        .registerContentObserver(
            android.provider.Settings.System.CONTENT_URI, true, mSettingsContentObserver);

    showProgressDialog();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.setStatusBarColor(getResources().getColor(R.color.activity_radio_background));
    }

    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    setContentView(R.layout.activity_radio);

    Intent i = getIntent();
    mShortcutData = i.getParcelableExtra(Constants.EXTRA_NAME_SHORTCUT_DATA);
    if (mShortcutData == null) {
      Log.e(TAG, "mShortcutData is not found..");
      finishActivity();
      return;
    }

    IntentFilter filter = new IntentFilter();
    filter.addAction(MusicService.ACTION_PLAYED);
    filter.addAction(MusicService.ACTION_PAUSED);
    filter.addAction(MusicService.ACTION_STOPPED);
    filter.addAction(MusicService.ACTION_COMPLETED);
    filter.addAction(MusicService.ACTION_ERROR);
    filter.addAction(MusicService.ACTION_PLAYING_STATUS);

    LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter);
    // send playing status
    Intent queryStatus = new Intent(this, MusicService.class);
    queryStatus.setAction(MusicService.ACTION_PLAYING_STATUS);
    startService(queryStatus);

    // ViewPager 화면.
    // 사용자등록이나 어플리케이션 설치등을수행하는 프래그먼트들이 불린다.
    mViewPager = (NbplusViewPager) findViewById(R.id.viewPager);
    mIndicator = (CirclePageIndicator) findViewById(R.id.indicator);

    // close button
    ImageButton closeButton = (ImageButton) findViewById(R.id.btn_close);
    closeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            finishActivity();
          }
        });

    mActivityLayout = (RelativeLayout) findViewById(R.id.radio_activity_background);
    int wallpaperId = LauncherSettings.getInstance(this).getWallpaperId();
    mActivityLayout.setBackgroundResource(LauncherSettings.landWallpaperResource[wallpaperId]);

    // title.
    mRadioTitle = (TextView) findViewById(R.id.radio_activity_label);

    // media controller
    mPlayToggle = (ImageButton) findViewById(R.id.ic_media_control_play);
    mPlayToggle.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (mCurrentPlayingStatus == null) {
              return;
            }
            MusicService.State state =
                (MusicService.State)
                    mCurrentPlayingStatus.getSerializable(MusicService.EXTRA_PLAYING_STATUS);
            Intent i = new Intent(RadioActivity.this, MusicService.class);
            if (state == MusicService.State.Playing) {
              i.setAction(MusicService.ACTION_PAUSE);
            } else if (state == MusicService.State.Paused) {
              i.setAction(MusicService.ACTION_PLAY);
            }
            startService(i);
          }
        });
    mPlayStop = (ImageButton) findViewById(R.id.ic_media_control_stop);
    mPlayStop.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (mCurrentPlayingStatus == null) {
              return;
            }
            MusicService.State state =
                (MusicService.State)
                    mCurrentPlayingStatus.getSerializable(MusicService.EXTRA_PLAYING_STATUS);
            if (state == MusicService.State.Playing || state == MusicService.State.Paused) {
              Intent i = new Intent(RadioActivity.this, MusicService.class);
              i.setAction(MusicService.ACTION_STOP);
              i.putExtra(MusicService.EXTRA_MUSIC_FORCE_STOP, false);
              startService(i);
            }
          }
        });

    mSoundToggle = (ImageButton) findViewById(R.id.ic_media_control_volume_btn);
    AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    int currentVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
    int maxVolume = audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    if (currentVolume <= 0) {
      mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_off);
    } else {
      mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_on);
    }
    mSoundToggle.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

            if (audio.getStreamVolume(AudioManager.STREAM_MUSIC) <= 0) {
              if (mSoundTogglePreviousValue > 0) {
                audio.setStreamVolume(
                    AudioManager.STREAM_MUSIC,
                    mSoundTogglePreviousValue,
                    AudioManager.FLAG_PLAY_SOUND);
              } else {
                mSoundTogglePreviousValue = 1;
                audio.setStreamVolume(
                    AudioManager.STREAM_MUSIC,
                    mSoundTogglePreviousValue,
                    AudioManager.FLAG_PLAY_SOUND);
              }
              mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_on);
              mSeekbar.setProgress(mSoundTogglePreviousValue);
              mSoundTogglePreviousValue = -1;
            } else {
              mSoundTogglePreviousValue = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
              audio.setStreamVolume(AudioManager.STREAM_MUSIC, 0, AudioManager.FLAG_PLAY_SOUND);
              mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_off);
            }
          }
        });

    mSeekbar = (SeekBar) findViewById(R.id.ic_media_control_volume_seek);
    mSeekbar.setMax(maxVolume);
    mSeekbar.setProgress(currentVolume);
    mSeekbar.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
              mSoundTogglePreviousValue = -1;
              AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
              audio.setStreamVolume(
                  AudioManager.STREAM_MUSIC, progress, AudioManager.FLAG_PLAY_SOUND);
            }
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}
        });

    getRadioChannelTask = new GetRadioChannelTask();
    if (getRadioChannelTask != null) {
      getRadioChannelTask.setBroadcastApiData(
          this, mHandler, mShortcutData.getDomain() + mShortcutData.getPath());
      mIsExecuteGetRadioChannelTask = true;
      getRadioChannelTask.execute();
    }
  }