diff --git a/src/com/upc/pbe/upcnews/Descarrega.java b/src/com/upc/pbe/upcnews/Descarrega.java index fe151f5..766974b 100644 --- a/src/com/upc/pbe/upcnews/Descarrega.java +++ b/src/com/upc/pbe/upcnews/Descarrega.java @@ -14,6 +14,7 @@ import android.widget.Toast; public class Descarrega extends AsyncTask { final static String TAG = "Descarrega"; private Context ctx; + boolean failed = false; public Descarrega(Context c) { ctx = c; @@ -41,10 +42,19 @@ public class Descarrega extends AsyncTask { in.close(); Log.d(TAG, "Descarrega finalitzada"); } catch (IOException e) { - this.cancel(true); - Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG).show(); - return ""; + failed = true; + return urls[0].toString(); } return html; } + + protected void onPostExecute(String url) + { + if(failed) + { + failed = false; + this.cancel(true); + Toast.makeText(ctx, "No s'ha pogut connectar a " + url, Toast.LENGTH_LONG).show(); + } + } } \ No newline at end of file