Organizational Research By

Surprising Reserch Topic

titanium httpclient the persistent handle is disposed using -'titanium-mobile,titanium-alloy,titanium-android'

titanium httpclient the persistent handle is disposed  using -'titanium-mobile,titanium-alloy,titanium-android'

I'm trying to download a big JSON form a WS. In iOS all work fine, but in Android the app crashes.

1.- Looking for a solution I found that it can be caused by the sqlite and I removed the; to avoid this problem. With this fix, this message doesn't appear anymore:

  Choreographer: Skipped 30 frames! The application may be doing too
  much work on its main thread.

2.- Now, the only strange message that I can see in the console is:

  HTTPClient: The persistent handle is disposed.

The console actually shows:

  [DEBUG] :  Module: Loading module: alloy/controllers/disponibleRow ->
  [DEBUG] :  Module:
  Loading module: alloy/controllers/usadoRow ->
  [DEBUG] :  dalvikvm:
  GC_CONCURRENT freed 2648K, 22% free 13644K/17456K, paused 4ms+22ms,
  total 88ms [DEBUG] :  AbsListView: Get MotionRecognitionManager
  [DEBUG] :  dalvikvm: GC_CONCURRENT freed 2371K, 24% free
  13320K/17456K, paused 3ms+3ms, total 56ms
  [DEBUG] :  dalvikvm:
  [DEBUG] :  dalvikvm:
  [DEBUG] :  HTTPClient: The
  persistent handle is disposed.
  [DEBUG] :  AbsListView:
  onDetachedFromWindow [DEBUG] :  AbsListView: onDetachedFromWindow
  [DEBUG] :  TabGroup: Tabgroup is closed normally.
  [ERROR] :
  ViewRootImpl: sendUserActionEvent() mView == null
  [ERROR] :
  ViewRootImpl: sendUserActionEvent() mView == null
  [DEBUG] :  Window:
  Window is closed normally.

My code with HTTP call:

var cupones = Alloy.Collections.cupones;

$;"Cargando cupones", true);

function obtenerCupones(){

    Ti.API.debug('-- obtenerCupones');
    var xhr = Titanium.Network.createHTTPClient();

    xhr.onload = function(e) {
        // this is where you would process the returned object.
        if (this.responseText != null) {
            Ti.API.debug("-- Response: " + this.responseText);
            var jsObj = JSON.parse(this.responseText);

            // Do something with the object
            var listadoCupones = jsObj.cupones;

            for(var i = 0; i < listadoCupones.length; i++){

                var cuponSel = listadoCupones[i];

                var cupon = Alloy.createModel("cupones", {
                    hash: cuponSel.hash,
                    nombre: cuponSel.nombre,
                    estado: cuponSel.estado,
                    fecha_compra: cuponSel.fecha_compra,
                    fecha_caducidad: cuponSel.fecha_caducidad,
                    qrcode: "",
                    code: "jk-ASDFkjkLDJ",
                    condiciones: "kalsjdflkjaldskfjalsjdfa",
                    latitud: 38.3435728,
                    longitud: -0.4895567

            //Rellenamos los datos de los listados

        } else {
           // Webservice returned nothing

    xhr.onerror = function(e) {
        // This is where you would catch any errors thrown from calling the webservice.
        // e.error holds the error message
        Ti.API.debug("--- ERROR: " + e.error);
    };'GET', url);
    xhr.setRequestHeader('Content-Type', "application/json; charset=utf-8");

function rellenarDatos(){

    var disponibles = [];
    var usados = [];

    for (var i = 0; i < cupones.length; i++) {

        var cuponAux =;

        if (cuponAux.get('estado') === 'disponible'){ // DISPONIBLES

            var disponibleRow = Alloy.createController('disponibleRow', {id: i, cupon: cuponAux}).getView();

        } else if (cuponAux.get('estado') === 'usado'){ //USADOS

            var usadoRow = Alloy.createController('usadoRow', cuponAux).getView();


    var tableDisponibles = Ti.UI.createTableView({  

    tableDisponibles.addEventListener('click', function(e){
        Ti.API.debug('row clicked: ' +;

    var tableUsados = Ti.UI.createTableView({  



My question in Appcelerator Q&A

Please, help me.

EDIT: I tried to charge only 5 rows and the error persists. The error is not caused by the amount of information.

asked Sep 7, 2015 by rajesh
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.