I am trying to download an mp3 file. For this i have created an activity like this:
public class audiostream extends Activity{
private Button streamButton;
private ImageButton playButton;
private TextView textStreamed;
private boolean isPlaying;
private StreamingMediaPlayer audioStreamer; //This is the object of supporting class
protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
            //other activities                     }
now on the button click event i am calling this function:
private void startStreamingAudio() {
        try { 
            final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar);
            if ( audioStreamer != null) {
                audioStreamer.interrupt();
            }
            audioStreamer = new StreamingMediaPlayer(this,textStreamed, playButton, streamButton,progressBar);
            audioStreamer.startStreaming("file path",file_size,duration);
            streamButton.setEnabled(false);
        } catch (IOException e) {
        }
    }
Give below is the StreamingMediaPlayer class:
public class StreamingMediaPlayer {
    private TextView textStreamed;
    private ImageButton playButton;
    private ProgressBar progressBar;
    public StreamingMediaPlayer(Context  context,TextView textStreamed, ImageButton playButton, Button  streamButton,ProgressBar    progressBar) 
        {
        this.context = context;
        this.textStreamed = textStreamed;
        this.playButton = playButton;
        this.progressBar = progressBar;
       }
}
Rest of the works are done by the remaining class such as incrementing the progress bar, playing the audio etc.
Progress bar increments as audio progresses. The issue that i am facing is that, while playing the audio, if i am pressing back button and opening previous activity the audio plays (this is what i want), but when i come back to the activity with the help of intent, everything appears in a way that activity is just created. The progress bar which was previously progressing now looks when i first opened this activity. In simple sentence the problem is that, the activity which is playing the audio file is not resuming the previous state. Kindly help me.
 
     
     
    