Android: Simple how to stop mediaplayer after given time
===

I am trying to play an mp3 file (with an onClickListener) and stop after 2 seconds. I tried the code below but it is not working. Could anyone please help?


    final MediaPlayer mpsound = MediaPlayer.create(this, R.raw.media_player_sound);
            
    ImageView sound = (ImageView) findViewById(R.id.button);
    
    sound.setOnClickListener(new View.OnClickListener() {
    			public void onClick(View v) {
    				mpsound.start();{
    					sleep(2000);
    					mpfrog.stop();
    				}
    			}
    		});