How to jump to an another line of code while executing an Android app <p>I want to know how to jump to an another line of code while executing an Android app. </p> <p><strong>Here is my problem in detail.</strong></p> <p>First of all, here is my code:-. </p> <pre><code> listView.setOnItemClickListener (new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { int Current_Song; Songs song = Song.get(i); //If mediaPlayer is not used before, this will make oldsong as present song. if (Old_Song == -326523) { Old_Song = song.getSong(); } Current_Song = song.getSong(); ImageView IVP_P = (ImageView) findViewById(R.id.P_PImage); //If mediaPlayer is paused. if (IsPaused) { P_and_P.setImageResource(R.drawable.ic_pause_white_48dp); //If the song paused is same as the new song. if (Current_Song == Old_Song) { mediaplayer.start(); } //If the song Paused is not the new song. else { if (mediaplayer != null) { mediaplayer.release(); mediaplayer = null; } int result = mAudioManager.requestAudioFocus(mOnAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { mediaplayer = mediaplayer.create(SongsListActivity.this, song.getSong()); Old_Song = song.getSong(); NameD.setText(song.getNameOfSong()); RateD.setText(song.getDeveloperRate()); ImageD.setImageResource(song.getImage()); mediaplayer.start(); mediaplayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { P_and_P.setImageResource(R.drawable.ic_play_arrow_white_48dp); IsPaused = true; } }); } } IsPaused = false; } else if (mediaplayer != null) { //If mediaPlayer is already Playing a song. if (mediaplayer.isPlaying()) { P_and_P.setImageResource(R.drawable.ic_play_arrow_white_48dp); mediaplayer.pause(); IVP_P.setImageResource(R.drawable.ic_play_arrow_black_24dp); IsPaused = true; } } //If mediaPlayer is used for first time and if mediaPlayer is neither paused else { if (mediaplayer != null) { mediaplayer.release(); mediaplayer = null; } int result = mAudioManager.requestAudioFocus(mOnAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { mediaplayer = mediaplayer.create(SongsListActivity.this, song.getSong()); Old_Song = song.getSong(); NameD.setText(song.getNameOfSong()); RateD.setText(song.getDeveloperRate()); ImageD.setImageResource(song.getImage()); mediaplayer.start(); P_and_P.setImageResource(R.drawable.ic_pause_white_48dp); mediaplayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { P_and_P.setImageResource(R.drawable.ic_play_arrow_white_48dp); IsPaused = true; P_and_P.setImageResource(R.drawable.ic_pause_white_48dp); } }); } } } } ); </code></pre> <p>Now, whenever the execution enters into any if the onCompletion() method, i want want the execution to start execution from beginning of the onItemClick() method. </p> <p>What should I do?</p> <p>For being more detailed:-</p> <p>Here my app displays a list of songs using ListView and Adapter. The details of songs are stored in a arrayList(As You All Can See).When an item is clicked, it gets the position of that item, then refers to the corresponding element of the arrayList, gets the location of the corresponding song and then plays that song. What I want is that when an song is over, and the method onCompletion() is called, I want to increase to value of i(look in the 4th line of my code) by one and then go to the first line of the onItemClick method.</p>