FATAL EXCEPTION: AsyncTask #1
Process: com.altipalAx, PID: 11429
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.OutOfMemoryError
at java.lang.String.<init>(String.java:255)
at java.lang.String.<init>(String.java:171)
at java.lang.String.<init>(String.java:141)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:184)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
at extras.Download.descargaAcuerdosComercial(Download.java:2119)
at com.altipalAx.Rutas$Sincronizar.doInBackground(Rutas.java:302)
at com.altipalAx.Rutas$Sincronizar.doInBackground(Rutas.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 3 more
android.view.WindowLeaked: Activity com.altipalAx.Rutas has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{21af4048 V.E..... R.....ID 0,0-465,346} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:376)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:286)
at com.altipalAx.Rutas$Sincronizar.onPreExecute(Rutas.java:276)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
at android.os.AsyncTask.execute(AsyncTask.java:535)
at com.altipalAx.Rutas.llamar_conexion(Rutas.java:211)
at com.altipalAx.Rutas.onclickRuta(Rutas.java:204)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3846)
at android.view.View.performClick(View.java:4466)
at android.view.View$PerformClick.run(View.java:18540)...
Si efectivamente un metodo async task para la peticion.
Mira de esta forma:
class Sincronizar extends AsyncTask<String, Void, Void> {
DatabaseHelper databaseHelper = new DatabaseHelper(Rutas.this);
SQLiteDatabase db = databaseHelper.getWritableDatabase();
AlertDialog ad2 = new AlertDialog.Builder(Rutas.this.getApplicationContext()).create();
private final ProgressDialog dialog2 = new ProgressDialog(Rutas.this);
private final ProgressDialog dialog4 = new ProgressDialog(Rutas.this);
int retorno;
public void onPreExecute() {
mLockScreenRotation();
myProgress = 0;
dialog = new ProgressDialog(Rutas.this);
dialog.setMessage("DESCARGANDO\nINFORMACIÓN...");
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setProgress(0);
dialog.setMax(100);
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(false);
dialog.show();
}
@Override
protected Void doInBackground(String... params) {
Looper.myLooper();
try {
Looper.prepare();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
//Limpio la tabla donde almaceno la informacion
AcuerdoComercialQuery acuerdoComercialQuery = new AcuerdoComercialQuery();
acuerdoComercialQuery.deleteAll(db);
retorno=download.descargaClientes3(db,configuracionBeans,myProgress=myProgress+2,dialog,zonaVentas,ruta);
return null;
}
@Override
protected void onPostExecute(Void result) {
dialog.cancel();
// 0 Ok
// 2 Problema conexion
// 3 Problema o error al leer los datos.
if(retorno == 0)
{
//Intent con el que continuo con el proceso.
}
if (retorno ==2) {
this.dialog4.setMessage("El equipo tiene problemas de conectividad, inténtelo nuevamente, si el problema persiste por favor comuníquese con su operador celular para verificar la conexión de datos");
this.dialog4.setCanceledOnTouchOutside(false);
this.dialog4.setCancelable(false);
this.dialog4.setButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
dialog4.dismiss();
}
});
this.dialog4.show();
return;
}
}
}