
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 1.06 KB | hits: 14 | expires: Never
public void playRecording(View view) {
mp = new MediaPlayer();
try {
if(new File(audiofile.getAbsolutePath())!=null)
{
mp.setDataSource(audiofile.getAbsolutePath());
mp.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "complete", Toast.LENGTH_SHORT).show();
if(counter >= limit)
{
mp.stop();
}
else
{
mp.start();
}
counter++;
}
});
mp.setVolume(100, 100);
mp.prepare();
mp.start();
}
else
{
Toast.makeText(MainActivity.this, "Pleast Record A File", Toast.LENGTH_LONG).show();
}
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}