Problems with fluency in my app

1

I already finished my app in android studio, but I have a detail, first of all I use Asynctask to work in the background calls of webservices, almost everything I use this way, but the problem is that I have a screen where I have a listview with a custom adapter that shows certain information in which the user can insert an amount in an edittext, but when the user makes more than 4 moves, the app starts to be encouraged and stays locked in some parts of the screen, I've tried it with 3 physical devices, with 2 I do not do it much, but with one if.

I do not know what problem my app has, I leave the image and code of that screen.

public class Detalle_Cliente extends AppCompatActivity {

//Dialogos
ProgressDialog dialog;
//Array Detalle
ArrayList<DetalleCxP> DetalleArrayList = new ArrayList<DetalleCxP>();
CXCPSaldoClienteProveedor O_Cliente;
DetalleMenu O_DetalleMenu;
Integer I_FormaPago=0;
//Manejo de Intent
final Context context = this;
private String obser;
private static final String TAG = "mx.com.oncontrol.oncontrolmovile";
//Array Forma de Pago
ArrayList<FormaPago> PagoArrayList = new ArrayList<FormaPago>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detalle__cliente);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    Intent intent = getIntent();
    O_DetalleMenu=(DetalleMenu) intent.getSerializableExtra("O_DetalleMenu");
    intent=getIntent();
    O_Cliente=(CXCPSaldoClienteProveedor) intent.getSerializableExtra("O_Cliente");
    setTitle(O_Cliente.getClienteDescripcion());

    //codigo listview
    SharedPreferences settings = getSharedPreferences("ONC_Settings", 0);
    AsyncCallWSDetalle task = new AsyncCallWSDetalle(settings.getString("ONControlWSURL", "").toString(),
                                                     settings.getString("ONControlToken", "").toString(),
                                                     settings.getInt("ONControlEmpresa", 0));
    //Call execute
    comenzarLocalizacion();
    task.execute();


   Button pagar = (Button)this.findViewById(R.id.pago);
    pagar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v)
        {
            LayoutInflater li = LayoutInflater.from(context);
            View pron = li.inflate(R.layout.row_dialog, null);

            AlertDialog.Builder alert = new AlertDialog.Builder(Detalle_Cliente.this);
            alert.setTitle("Confirmacion De Pago");
            alert.setMessage("Observaciones");


            alert.setView(pron);
            final EditText observ = (EditText)pron.findViewById(R.id.edtobser);
            obser = observ.getText().toString();
            alert.setCancelable(false);
            alert.setPositiveButton("Aceptar", new DialogInterface.OnClickListener()  {
                public void onClick(DialogInterface dialog, int id) {
                    I_FormaPago=((FormaPago)((Spinner)findViewById(R.id.spinnerforma)).getSelectedItem()).getId();

                    obser = observ.getText().toString();
                    comenzarLocalizacion();
                    SharedPreferences settings = getSharedPreferences("ONC_Settings", 0);
                    AsyncGrabarCXCP task = new AsyncGrabarCXCP(settings.getString("ONControlWSURL", "").toString(),
                                                               settings.getString("ONControlToken", "").toString(),
                                                               settings.getInt("ONControlEmpresa", 0),
                                                               settings.getString("ONControlUsuario", "").toString(),
                                                               false);


                    //Call execute
                    task.execute();
                }
            });
            alert.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
            alert.show();
        }//fin onclick
    });


   Button Pagoc = (Button)this.findViewById(R.id.pagoceros);
    Pagoc.setOnClickListener(new View.OnClickListener() {
        @TargetApi(Build.VERSION_CODES.LOLLIPOP)
        @Override
        public void onClick(View v)
        {
            LayoutInflater li = LayoutInflater.from(context);
            View pron = li.inflate(R.layout.row_dialog, null);

            AlertDialog.Builder alert = new AlertDialog.Builder(context);
            alert.setTitle("Confirmacion de Pago en 0!");
            alert.setMessage("Favor Ingresa el Motivo Por el " +
                              "cual no se realizo el Pago");
            alert.setView(pron);
            final EditText observ = (EditText)pron.findViewById(R.id.edtobser);
            obser = observ.getText().toString();
            alert.setCancelable(false);
            alert.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which)
            {

                obser = observ.getText().toString();
                if (obser != null && obser.trim().length() ==0) {

                    Context context = getApplicationContext();
                    CharSequence error = "Porfavor de  Ingresa un Motivo del Pago en 0!" +obser;
                    int duration = Toast.LENGTH_SHORT;

                    Toast toast = Toast.makeText(context, error, duration);
                    toast.show();
                }else {
                    comenzarLocalizacion();

                    SharedPreferences settings = getSharedPreferences("ONC_Settings", 0);
                    AsyncGrabarCXCP task = new AsyncGrabarCXCP(settings.getString("ONControlWSURL", "").toString(),
                                                               settings.getString("ONControlToken", "").toString(),
                                                               settings.getInt("ONControlEmpresa", 0),
                                                               settings.getString("ONControlUsuario", "").toString(),
                                                               true);
                    obser = observ.getText().toString();
                    //Call execute
                    task.execute();
                }


            }
        });
            alert.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                       dialog.cancel();
                }
            });
            alert.show();
        }
    });

}
//Codigo de Buscador en la parte del ActionBar
@Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_detalle, menu);
    SharedPreferences settings = getSharedPreferences("ONC_Settings", 0);
    AsyncForma task = new AsyncForma(settings.getString("ONControlWSURL", "").toString(),
                                     settings.getString("ONControlToken", "").toString(),
                                     settings.getInt("ONControlEmpresa", 0));
    //Call execute
    task.execute();
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

private void comenzarLocalizacion() {
    //Obtenemos una referencia al LocationManager
    LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    //Obtenemos la última posición conocida
    Location loc = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

    if(loc != null)
    {
        O_Cliente.setGPSLocation("http://maps.google.com/maps?q=" + String.valueOf(loc.getLatitude() + ",+" + String.valueOf(loc.getLongitude())));
    }
    LocationListener locListener = new LocationListener() {


        public void onLocationChanged(Location location) {
            if(location.getLatitude() != 0.0D && location.getLongitude() != 0.0D) {
                try {
                    Geocoder e = new Geocoder(Detalle_Cliente.this, Locale.getDefault());
                    List list = e.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
                    if(!list.isEmpty()) {
                        Address DirCalle = (Address)list.get(0);
                        //direccion.setText("Mi direccion es: \n" + DirCalle.getAddressLine(0));
                        O_Cliente.setGPSLocation2(DirCalle.getAddressLine(0));
                    }
                } catch (IOException var5) {
                    var5.printStackTrace();
                }
            }

        }

        public void onProviderDisabled(String provider) {
            //lblEstado.setText("Provider OFF");
        }

        public void onProviderEnabled(String provider) {
            //lblEstado.setText("Provider ON ");
        }

        public void onStatusChanged(String provider, int status, Bundle extras) {
        }
    };

    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        //    ActivityCompat#requestPermissions
        // here to request the missing permissions, and then overriding
        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
        //                                          int[] grantResults)
        // to handle the case where the user grants the permission. See the documentation
        // for ActivityCompat#requestPermissions for more details.
        return;
    }
    locManager.requestLocationUpdates(
            LocationManager.GPS_PROVIDER, 1000, 0, locListener);
}


private class AsyncCallWSDetalle extends AsyncTask<String, ArrayList, ArrayList> {

    private String ONControlWSURL;
    private int ONControlZonaCliente;
    private String ONControlToken;
    private int ONControlEmpresa;
    private String ONControlUsuario;

    public AsyncCallWSDetalle(String ONControlWSURL,
                              String ONControlToken,
                              int ONControlEmpresa)
    {
        this.ONControlWSURL = ONControlWSURL;
        this.ONControlToken = ONControlToken;
        this.ONControlEmpresa = ONControlEmpresa;
    }


    @Override
    protected ArrayList doInBackground(String... params){
        DetalleArrayList = new ArrayList<DetalleCxP>();
        webService O_WS = new webService(ONControlWSURL,
                                         ONControlZonaCliente,
                                         ONControlToken,
                                         ONControlEmpresa,
                                         ONControlUsuario);
        DetalleArrayList=O_WS.DetalleCxP(O_Cliente.getCliente(),
                                         O_DetalleMenu.getDocumento(),
                                         O_Cliente.getMoneda());
        return null;
    }

    @Override
    //Make Progress Bar visible
    protected void onPreExecute() {

        dialog=new ProgressDialog(Detalle_Cliente.this);
        dialog.setIndeterminate(false);
        dialog.setMessage("Cargando Detalle...");
        dialog.setCancelable(false);
        dialog.show();
    }

    //Once WebService returns response
    @Override
    protected void onPostExecute(ArrayList arrayList) {
        super.onPostExecute(arrayList);
        if(DetalleArrayList.size()!=0){
            dialog.dismiss();

            MyArrayAdapter adaptador= new MyArrayAdapter(Detalle_Cliente.this, DetalleArrayList);///* no se usa your_array_list
            ListView list = (ListView) findViewById(R.id.listDeta);
            list.setAdapter(adaptador);
            adaptador.notifyDataSetChanged();
        }else{
            dialog.dismiss();
            Toast.makeText(getApplicationContext(),"No se Pudieron Cargar los datos" + " - "+ arrayList,Toast.LENGTH_SHORT).show();
        }
    }
}

public class MyArrayAdapter extends ArrayAdapter<DetalleCxP> {

    public MyArrayAdapter(Context context, ArrayList<DetalleCxP> ArrayClientes) {
        super(context, 0, ArrayClientes);
    }

    public View getView(int position, View convertView, ViewGroup parent) {

        DetalleCxP O_DetalleCxP = getItem(position);
        if (convertView == null)
        {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_detalle, parent, false);
            ((EditText) convertView.findViewById(R.id.edt_abono)).addTextChangedListener(new TB_Abono_Watcher(convertView));
        }

        ((EditText) convertView.findViewById(R.id.edt_abono)).setTag(O_DetalleCxP);
        if(O_DetalleCxP.TotalAplicado != 0){
            ((EditText) convertView.findViewById(R.id.edt_abono)).setText(String.valueOf(O_DetalleCxP.TotalAplicado));
        }
        else {
            ((EditText)convertView.findViewById(R.id.edt_abono)).setText("");
        }

        DecimalFormat numberFormat  = new DecimalFormat("###,##0.00");

        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

        ((TextView)convertView.findViewById(R.id.txtFecha)).setText(dateFormat.format(O_DetalleCxP.getFecha()));
        ((TextView)convertView.findViewById(R.id.txtFolio)).setText(O_DetalleCxP.getFolio());
        ((TextView)convertView.findViewById(R.id.total)).setText(numberFormat.format(O_DetalleCxP.getTotal()));
        ((TextView)convertView.findViewById(R.id.txttotal)).setText(numberFormat.format(O_DetalleCxP.getSaldo()));
        ((TextView)convertView.findViewById(R.id.txtvencido)).setText(numberFormat.format(O_DetalleCxP.getSaldoVencido()));
        ((TextView)convertView.findViewById(R.id.parcialidad)).setText((numberFormat.format(O_DetalleCxP.getParcialidadTotal()) +" - "+ O_DetalleCxP.getParcialidad()));
        ((TextView)convertView.findViewById(R.id.pagoforma)).setText(O_DetalleCxP.getPagoCondicionDescripcion());
        ((TextView)convertView.findViewById(R.id.UltimoCobroObservacion)).setText(O_DetalleCxP.getUltimoCobroObservacion());

        //Devolver al ListView la fila creada
        return convertView;
    }
}

//Clase para Edittext
private class TB_Abono_Watcher implements TextWatcher{


   Button pagar =(Button)findViewById(R.id.pago);
    private View view;
    private TB_Abono_Watcher(View view) {
        this.view = view;
    }

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }
    public void afterTextChanged(Editable s)
    {
        DetalleCxP O_DetalleCxP = (DetalleCxP)((EditText)view.findViewById(R.id.edt_abono)).getTag();

        if (O_DetalleCxP.getViewChanged()==false) {

            O_DetalleCxP.TotalAplicado = ONC_SYS.NullToZeroDouble(s.toString());

            Double Total = 0.0;
            for (int i = 0; i < DetalleArrayList.size(); i++) {
                if (((DetalleCxP) DetalleArrayList.get(i)).TotalAplicado > 0) {
                    Total += ((DetalleCxP) DetalleArrayList.get(i)).TotalAplicado;
                }
            }
            DecimalFormat numberFormat = new DecimalFormat("###,##0.00");
            ((TextView) findViewById(R.id.Total)).setText(numberFormat.format(Total));

            if (Total == 0) {
                ((Button) findViewById(R.id.pagoceros)).setEnabled(true);
                ((Button) findViewById(R.id.pago)).setEnabled(false);
            } else {
                ((Button) findViewById(R.id.pagoceros)).setEnabled(false);
                ((Button) findViewById(R.id.pago)).setEnabled(true);
            }

            //Validacion que no te deje hacer un abono Mayo al saldo vencido
            if (O_DetalleCxP.getSaldo() < O_DetalleCxP.TotalAplicado) {
                Toast.makeText(getApplicationContext(), "No puedes Aplicar un Abono Mayor al SaldoVencido", Toast.LENGTH_SHORT).show();
                ((EditText) view.findViewById(R.id.edt_abono)).setText("");

            }
        }

    }
}

//Medoto para Grabar datos
public class AsyncGrabarCXCP extends AsyncTask<Void,Integer,webService.STR_Resultado>
{

    private String ONControlWSURL;
    private int ONControlZonaCliente;
    private String ONControlToken;
    private int ONControlEmpresa;
    private String ONControlUsuario;
    private boolean PagoCeros=false;

    public AsyncGrabarCXCP(String ONControlWSURL,
                           String ONControlToken,
                           int ONControlEmpresa,
                           String ONControlUsuario,
                           boolean PagoCeros)
    {
        this.ONControlUsuario = ONControlUsuario;
        this.ONControlWSURL = ONControlWSURL;
        this.ONControlToken = ONControlToken;
        this.ONControlEmpresa = ONControlEmpresa;
        this.PagoCeros = PagoCeros;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        dialog=new ProgressDialog(Detalle_Cliente.this);
        dialog.setIndeterminate(false);
        dialog.setMessage("Procesando Datos...");
        dialog.setCancelable(false);
        dialog.show();
    }

    @Override
    protected webService.STR_Resultado doInBackground(Void... params) {
        int Resultado=0;
        webService O_WS = new webService(ONControlWSURL,
                                         ONControlZonaCliente,
                                         ONControlToken,
                                         ONControlEmpresa,
                                         ONControlUsuario);
        //Date O_D = new Date();

        Double Factor=0.0, Importe=0.0, Descuento=0.0, SubTotal=0.0, Total=0.0, IVA=0.0,Retencion1=0.0,Retencion2=0.0,IEPS=0.0;

        Double DFactor=0.0;

        final int count = DetalleArrayList.size();

        for(int i=0;i<count;i++) {

            Factor=0.0;

            if (((DetalleCxP)DetalleArrayList.get(i)).TotalAplicado>0)
            {
                Factor = ((DetalleCxP)DetalleArrayList.get(i)).TotalAplicado / ((DetalleCxP)DetalleArrayList.get(i)).Total;

                Importe += ((DetalleCxP)DetalleArrayList.get(i)).Importe*Factor;
                Descuento += ((DetalleCxP)DetalleArrayList.get(i)).Descuento*Factor;
                SubTotal += ((DetalleCxP)DetalleArrayList.get(i)).SubTotal*Factor;
                IVA += ((DetalleCxP)DetalleArrayList.get(i)).IVA*Factor;
                Retencion1 += ((DetalleCxP)DetalleArrayList.get(i)).Retencion1*Factor;
                Retencion2 += ((DetalleCxP)DetalleArrayList.get(i)).Retencion2*Factor;
                IEPS += ((DetalleCxP)DetalleArrayList.get(i)).IEPS*Factor;
                Total += ((DetalleCxP)DetalleArrayList.get(i)).Total*Factor;
            }

        }

        webService.STR_Resultado O_ResultadoEncabezado = null;

        O_ResultadoEncabezado = O_WS.LLenarEncabezadoCXCP("I",    //Accion I
                0,      //Id = 0
                "",
                new Date(),
                O_Cliente.getCliente(),
                O_Cliente.getProveedor(),
                O_Cliente.getMoneda(),
                1.0,      //Tipo de Cambio por default 1
                0,      //Cuenta Bancaria
                I_FormaPago,          //Pago Forma
                Total,          //Saldo
                Importe,    //Importe
                0,          //Financiamiento
                Descuento,
                SubTotal,
                Retencion1,
                Retencion2,
                IEPS,
                IVA,
                0,          //ISH,
                Total,      //Total
                Total,      //totalaplicado,
                "A",        //status,
                "",         //usucariocancela,
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,   //Numero1...Numero10
                O_Cliente.getGPSLocation(), //Texto1
                O_Cliente.getGPSLocation2(),  //Texto2
                "","","","","","","","",                      //Texto1...Texto10
                new Date(),new Date(),new Date(),new Date(),new Date(),new Date(),  //Fecha1...Texto6
                obser,         //Observacion
                0,0,0,0,0,0,         //Catalogo1...Catalogo6
                "",         //ordencompra
                0,          //concepto
                "",         //observacioncancelacion
                0,          //origenventacompra,
                0           //origeninventario
        );
        if (O_ResultadoEncabezado.ErrorId == 0)
        {

            for(int i=0;i<DetalleArrayList.size();i++) {



                if (((((DetalleCxP)DetalleArrayList.get(i)).TotalAplicado>0) && (PagoCeros=false)) || ((((DetalleCxP)DetalleArrayList.get(i)).TotalAplicado ==0) && (PagoCeros=true)))
                {
                    DFactor = ((DetalleCxP)DetalleArrayList.get(i)).TotalAplicado / ((DetalleCxP)DetalleArrayList.get(i)).Total;


                    Resultado = Integer.parseInt(O_WS.LLenarDetalleCXCP
                            ("I", //Accion
                            0, //id
                            ((DetalleCxP)DetalleArrayList.get(i)).getId(),  //Origen
                            ((DetalleCxP)DetalleArrayList.get(i)).getDocumento(),  //OrigenDocumento
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).Importe*DFactor),   //Importe
                            (Double)0.0,  //Financiamiento
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).Descuento*DFactor), //Descuento
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).SubTotal*DFactor),   //Subtotal
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).Retencion1*DFactor), //Retencion1
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).Retencion2*DFactor),  //Retencion2
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).IEPS*DFactor),   //IEPS
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).IVA*DFactor), //IVA
                            (Double)0.0, //ISH
                            (Double)(((DetalleCxP)DetalleArrayList.get(i)).Total*DFactor),  //Total
                            ((DetalleCxP)DetalleArrayList.get(i)).getSaldo(),   //Saldo
                            "Android App"      //Referencia
                    ));
                }
            }
        }

        webService.STR_Resultado O_Resultado = null;

        if (Resultado == 0)
        {
            O_Resultado = O_WS.GrabarCxCP(O_DetalleMenu.getModulo(),      //Modulo
                                        O_DetalleMenu.getOperacion(),      //Operacion
                                        O_DetalleMenu.getDocumento(),      //Documento
                                        0,      //OrigenId
                                        0);     //OrigenDocumento
        }

        return O_Resultado;
    }

    @Override
    protected void onPostExecute(webService.STR_Resultado Resultado) {
        super.onPostExecute(Resultado);
        if (Resultado.ErrorId == 0 )
        {
            dialog.dismiss();
            AlertDialog.Builder alert = new AlertDialog.Builder(Detalle_Cliente.this);
            alert.setTitle(Resultado.Mensaje);
            alert.setMessage(" Folio:" + Resultado.Folio  );
            alert.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                    finish();
                }
            });
            alert.show();
        }else{
            dialog.dismiss();
            Toast.makeText(getApplicationContext(), "Error en el Webservices" + "" + Resultado.Mensaje, Toast.LENGTH_LONG).show();
        }
    }
}

public DetalleCxP FindCXCPSaldoClienteProveedorById(int Id)
{
    for(int i=0;i<DetalleArrayList.size();i++)
    {
        if (DetalleArrayList.get(i).getId()==Id)
        {
            return DetalleArrayList.get(i);
        }
    }
    return null;
}


private class AsyncForma extends AsyncTask<String, ArrayList, ArrayList>
{
    private String ONControlWSURL;
    private int ONControlZonaCliente;
    private String ONControlToken;
    private int ONControlEmpresa;
    private String ONControlUsuario;

    public AsyncForma(String ONControlWSURL,String ONControlToken,int ONControlEmpresa)
    {
        this.ONControlWSURL = ONControlWSURL;
        this.ONControlToken = ONControlToken;
        this.ONControlEmpresa = ONControlEmpresa;
    }
    @Override
    protected ArrayList doInBackground(String... params) {
        PagoArrayList = new ArrayList<FormaPago>();
        webService O_WS = new webService(ONControlWSURL,ONControlZonaCliente,ONControlToken,ONControlEmpresa,ONControlUsuario);
        PagoArrayList=O_WS.FormaPago();
        return null;
    }

    @Override
    protected void onPostExecute(ArrayList arrayList) {
        super.onPostExecute(arrayList);

        if(PagoArrayList.size()!=0){

            Spinner spinner = (Spinner)findViewById(R.id.spinnerforma);
            ArrayAdapter<FormaPago> adapter = new ArrayAdapter<FormaPago>(context, android.R.layout.simple_spinner_dropdown_item, PagoArrayList);
            spinner.setAdapter(adapter);

        }else{

        }
    }
}


@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@SuppressLint("LongLogTag")
@Override
protected void onDestroy() {
    super.onDestroy();
   Log.i(TAG, "onDestroy");
    DetalleArrayList = null;
    O_DetalleMenu = null;
    obser = null;
    PagoArrayList = null;
    Runtime.getRuntime().gc();
   deleteCache(context);
}

//Codigo eliminar cache app
public static void deleteCache(Context context) {
    try {
        File dir = context.getCacheDir();
        deleteDir(dir);
    } catch (Exception e) {}
}

public static boolean deleteDir(File dir) {
    if (dir != null && dir.isDirectory()) {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++) {
            boolean success = deleteDir(new File(dir, children[i]));
            if (!success) {
                return false;
            }
        }
        return dir.delete();
    }
    else if(dir!= null && dir.isFile())
        return dir.delete();
    else {
        return false;
    }
}

}

    
asked by Hugo Rodriguez 20.06.2016 в 17:20
source

0 answers