I'm writing an Android application that streams live radio. I've set up an async task to display a progress dialog whilst the stream is loading. This works fine, however when it encounters a stream that is "down" and not functioning my app crashes and I just want to know the best way to handle the error.
Here is the code:
public class loadingData extends AsyncTask<Object, Object, Object>{
protected void onPreExecute() {
progDialog = new ProgressDialog(radioplayer.this);
progDialog.setMessage("Loading radio station");
progDialog.setIndeterminate(true);
progDialog.setCancelable(false);
progDialog.show();
}
protected Object doInBackground(Object... arg0) {
prs.setStation(strStation);
return null;
}
protected void onCancelled() {
super.onCancelled();
}
protected void onPostExecute(Object result) {
progDialog.hide();
}
protected void onProgressUpdate(Object... values) {
}
}