package android.TICO.AsyncTasks; import android.media.MediaPlayer; import android.os.AsyncTask; import configuration.TSetup; /** * AsyncTask for plays a Sound given by this url * * @param url String with the URL of the sound */ public class playSound extends AsyncTask { public static MediaPlayer mp=new MediaPlayer(); @Override protected Void doInBackground(String... url) { mp.stop(); mp.reset(); mp.setVolume(TSetup.getVolume(), TSetup.getVolume()); try { mp.setDataSource(url[0]); mp.prepare(); mp.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } protected void onCancelled(Void nada) { mp.stop(); } }