gt:     protected void onSaveInstanceState(Bundle outState) {
context: package com.neelraj.android.muzik;
  
  import android.content.ComponentName;
  import android.content.Context;
  import android.content.Intent;
  import android.content.ServiceConnection;
  import android.content.res.Resources;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.drawable.BitmapDrawable;
  import android.graphics.drawable.Drawable;
  import android.media.MediaPlayer;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.Handler;
  import android.os.IBinder;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.Toolbar;
  import android.util.TypedValue;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.ListView;
  import android.widget.SeekBar;
  import android.widget.TextView;
  
  import com.astuetz.PagerSlidingTabStrip;
  
  import java.util.ArrayList;
  
  public class NowPlaying extends ActionBarActivity implements SeekBar.OnSeekBarChangeListener {
      private Toolbar toolbar;
      private final Handler handler = new Handler();
      private Intent intent;
      private MediaPlayer player;
      private Resources res;
      private PagerSlidingTabStrip tabs;
      private String palbumkey="";
      boolean donotrefresh=false;
      private ViewPager pager;
      private MyPagerAdapter adapter;
      private ImageView imgvStop;
  
      private Drawable oldBackground = null;
      private int currentColor = 0xFF666666;
      int playing=2;
      public ArrayList<String> songList;
      private ListView songView;
      String[] sarkilarlistesi;
      //service
      public MusicService musicSrv;
      private Intent playIntent;
      private Bitmap albumart;
      ImageView albumimage;
      //binding
      private boolean musicBound=false;
      private SeekBar musicSeekBar;
      private TextView songCurrentDurationLabel;
      private TextView songTotalDurationLabel;
      public static boolean isShuffle = false;
      public static boolean isRepeat = false;
      ImageView shuffle;
      ImageView repeat;
  
      //controller
  
  
      //activity and playback pause flags
      private boolean paused=false, playbackPaused=false;
      Handler updateViewHandler = new Handler();
      private ServiceConnection musicConnection = new ServiceConnection(){
  
          @Override
          public void onServiceConnected(ComponentName name, IBinder service) {
              MusicService.MusicBinder binder = (MusicService.MusicBinder)service;
              //get service
              musicSrv = binder.getService();
  
              musicBound = true;
              updateViewFromService();
          }
  
          @Override
          public void onServiceDisconnected(ComponentName name) {
              musicBound = false;
          }
      };
  
      @Override
      public void onStart() {
          super.onStart();
          res=getResources();
          if(playIntent==null){
              playIntent = new Intent(getApplicationContext(), MusicService.class);
              getApplicationContext().bindService(playIntent, musicConnection, Context.BIND_AUTO_CREATE);
              getApplicationContext().startService(playIntent);
  
          }
  
      }
      public void recycleAlbumArt(){
          try{((BitmapDrawable)albumimage.getDrawable()).getBitmap().recycle();
              albumimage.setImageDrawable(null);
              albumart.recycle();
          }
  
          catch(NullPointerException ex){
              ex.printStackTrace();
          }
      }
      @Override
      public void onPause(){
          super.onPause();
          donotrefresh=true;
          recycleAlbumArt();
          albumart=BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.pixel);
          albumimage.setImageBitmap(albumart);
  
      }
      @Override
      public void onResume(){
          super.onResume();
          palbumkey="";
          donotrefresh=false;
          if(musicBound) {
              updateViewFromService();
          }
          if(isShuffle)
              shuffle.setImageResource(R.drawable.btn_playback_shuffle_all);
          if(isRepeat)
              repeat.setImageResource(R.drawable.btn_playback_repeat_all);
           recycleAlbumArt();
  
  
      }
      @Override
      public void onDestroy(){
          super.onDestroy();
          donotrefresh=true;
          recycleAlbumArt();
  
      }
      @Override
      public void onStop(){
          super.onStop();
          donotrefresh=true;
          recycleAlbumArt();
  
      }
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.now_playing);
          toolbar = (Toolbar) findViewById(R.id.appbar);
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setTitle("");
          Intent servicestart = new Intent(this, MusicService.class);
          startService(servicestart);
          albumimage = (ImageView) findViewById(R.id.albumArt);
         // albumimage.setColorFilter(Color.argb(100,0,0,0));
          imgvStop=(ImageView)findViewById(R.id.stop);
          repeat= (ImageView) findViewById(R.id.repeat);
          shuffle = (ImageView) findViewById(R.id.shuffle);
  
  
          getWindow().getDecorView().setSystemUiVisibility(
                  View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                          | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
  
          tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
  
  
          imgvStop=(ImageView)findViewById(R.id.stop);
  
          adapter = new MyPagerAdapter(getSupportFragmentManager());
  
  
  
          final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
                  .getDisplayMetrics());
  
  
  
  
          musicSeekBar = (SeekBar) findViewById(R.id.seekBar);
          musicSeekBar.setOnSeekBarChangeListener(this);
          songCurrentDurationLabel = (TextView) findViewById(R.id.songCurrentDurationLabel);
          songTotalDurationLabel = (TextView) findViewById(R.id.songTotalDurationLabel);
  
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
  
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
  
  
          return super.onOptionsItemSelected(item);
      }
      Runnable run = new Runnable() {
  
          @Override
          public void run() {
  
              updateViewFromService();
             // update();
          }
      };
  
      public void updateViewFromService(){
          String title=musicSrv.getTitle();
  
          String info, album,artist;
          if(title.isEmpty()||title.equals(""))
          {
              title=res.getString(R.string.app_name);
              album="";
              artist="";
              info="";
          }
          else
          {
              album=musicSrv.getAlbum();
              artist=musicSrv.getArtist();
              if(title.length()>40)
                  title=title.substring(0,40)+"...";
              if(album.length()>20)
                  album=album.substring(0,20)+"...";
              if(artist.length()>20)
                  artist=artist.substring(0,20)+"...";
              info=album+" "+res.getString(R.string.by)+" "+artist;
          }
          ((TextView)findViewById(R.id.infoSongTitle)).setText(title);
          ((TextView)findViewById(R.id.infoAlbumTitle)).setText(info);
          int s=160;
          if(musicSrv.getAlbumKey()!=null&&!palbumkey.equals(musicSrv.getAlbumKey())) {
  
              try {
  
                  String art=MusicLibrary.getAlbumArt(getApplicationContext(),musicSrv.getAlbumKey());
                  if(art!=null&&!art.equals("")) {
                      final BitmapFactory.Options options = new BitmapFactory.Options();
                      options.inJustDecodeBounds = true;
                      BitmapFactory.decodeFile(art, options);
                      options.inSampleSize = MusicLibrary.calculateInSampleSize(options, s, s);
                      options.inJustDecodeBounds = false;
                      try{recycleAlbumArt();}catch (NullPointerException e){}
                      albumart = BitmapFactory.decodeFile(art, options);
  
                      albumimage.setImageBitmap(albumart);
  
  
  
                  }
                  else{
                      final BitmapFactory.Options options = new BitmapFactory.Options();
                      options.inJustDecodeBounds = true;
                      BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.cover_logo,options);
                      options.inSampleSize = MusicLibrary.calculateInSampleSize(options, s, s);
                      options.inJustDecodeBounds = false;
                      albumart=BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.cover_logo,options);
  
  
                      albumimage.setImageBitmap(albumart);
  
                  }
  
              } catch (Exception ex) {
  
                  final BitmapFactory.Options options = new BitmapFactory.Options();
                  options.inJustDecodeBounds = true;
                  BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.cover_logo,options);
                  options.inSampleSize = MusicLibrary.calculateInSampleSize(options, s, s);
                  options.inJustDecodeBounds = false;
                  albumart=BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.cover_logo,options);
                  albumimage.setImageBitmap(albumart);
              }
              palbumkey=musicSrv.getAlbumKey();
          }
          if(musicSrv.isPlaying()) {
              if(playing!=1)
                  imgvStop.setImageResource(R.drawable.stop);
              long totalDuration = musicSrv.getDuration();
              long currentDuration = musicSrv.currentPosition();
  
  
              // Displaying Total Duration time
              songTotalDurationLabel.setText(""+current((totalDuration)));
              // Displaying time completed playing
              songCurrentDurationLabel.setText(""+(current(currentDuration)));
              // Updating progress bar
              int progress = (int)(getProgressPercentage(currentDuration, totalDuration));
              //Log.d("Progress", ""+progress);
              musicSeekBar.setProgress(progress);
          }
          else{
              if(playing!=0)
                  imgvStop.setImageResource(R.drawable.play);
  
          }
  
  
  
  
          if(!donotrefresh) {
              updateViewHandler.postDelayed(run, 1000);
          }
      }
  
  
      public void onControlClicked(View v) {
  
          String command = v.getTag().toString();
          if(command.equals("stop")){
              if(musicSrv.isPlaying()) {
                  musicSrv.pause();
                  imgvStop.setImageResource(R.drawable.play);
                  playing=0;
              }
              else{
                  musicSrv.start();
                  if(musicSrv.isPlaying()) {
                      imgvStop.setImageResource(R.drawable.stop);
                      playing = 1;
                  }
              }
          }
  
  
          else if(command.equals("next")){
              if(musicSrv.isPrepared()) {
                  musicSrv.playNext();
              }
          }
          else if(command.equals("prev")){
              if(musicSrv.isPrepared()) {
                  musicSrv.playPrev();
              }
          }
          else if (command.equals("shuffle")) {
              if (isShuffle) {
                  isShuffle = false;
  
  
                  shuffle.setImageResource(R.drawable.btn_playback_shuffle);
              } else {
                  // make repeat to true
                  isShuffle = true;
  
                  // make shuffle to false
                  isRepeat = false;
                  shuffle.setImageResource(R.drawable.btn_playback_shuffle_all);
                  repeat.setImageResource(R.drawable.btn_playback_repeat);
  
              }
          }
          else if (command.equals("repeat")) {
                  if (isRepeat){
                      isRepeat=false;
  
                      repeat.setImageResource(R.drawable.btn_playback_repeat);
                  }
              else{
                      isRepeat=true;
                      isShuffle=false;
                      repeat.setImageResource(R.drawable.btn_playback_repeat_all);
                      shuffle.setImageResource(R.drawable.btn_playback_shuffle);
                  }
  
  
              }
  
          }
  
  
  
      @Override
  