From 8eda87988db324100a63088a677da416f35c0384 Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Wed, 19 Dec 2012 16:45:53 +0000 Subject: [PATCH] He arreglat un crash tope de random --- src/com/upc/pbe/upcnews/Descarrega.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 -- libgit2 0.22.2