Question

I think that my issue may be related to this stack post (Android remote method data limit) - only the size of the data being returned is 661KB and the article says that the binder can support 1MB.

Here is the situation: I have an async task that takes a single parameter and calls a web service that returns an array list of pipe delimited string and integer values. Im then taking those values and inserting them in to a JAVA arraylist. In smaller datasets this works fine. In larger datasets (ie, this 661KB dataset) I get the error below.

LOGCAT:

12-12 15:33:46.118: D/ProgressBar(14998): setProgress = 0
12-12 15:33:46.118: D/ProgressBar(14998): setProgress = 0, fromUser = false
12-12 15:33:46.118: D/ProgressBar(14998): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 10000
12-12 15:33:46.168: I/Async_GetAllTechSched(14998): create soap object
12-12 15:33:46.168: I/Async_GetAllTechSched(14998): create envelope
12-12 15:33:46.168: I/Async_GetAllTechSched(14998): create transport
12-12 15:33:46.208: D/ProgressBar(14998): updateDrawableBounds: left = 0
12-12 15:33:46.208: D/ProgressBar(14998): updateDrawableBounds: top = 0
12-12 15:33:46.208: D/ProgressBar(14998): updateDrawableBounds: right = 144
12-12 15:33:46.208: D/ProgressBar(14998): updateDrawableBounds: bottom = 144
12-12 15:33:51.613: D/dalvikvm(14998): GC_FOR_ALLOC freed 6262K, 37% free 18436K/29244K, paused 24ms, total 24ms
12-12 15:33:51.944: D/dalvikvm(14998): GC_FOR_ALLOC freed 594K, 36% free 18880K/29244K, paused 29ms, total 30ms
12-12 15:33:51.974: D/dalvikvm(14998): GC_FOR_ALLOC freed <1K, 34% free 19556K/29244K, paused 29ms, total 29ms
12-12 15:33:52.084: D/dalvikvm(14998): GC_FOR_ALLOC freed 2307K, 27% free 21387K/29244K, paused 20ms, total 20ms
12-12 15:33:52.204: D/dalvikvm(14998): GC_FOR_ALLOC freed 1597K, 25% free 22117K/29244K, paused 22ms, total 22ms
12-12 15:33:52.244: I/Async_GetAllTechSched(14998): pre SOAP response
12-12 15:33:52.244: I/Async_GetAllTechSched(14998): post SOAP response
12-12 15:33:52.244: I/Async_GetAllTechSched(14998): PRE - add response to array
12-12 15:33:52.244: I/Async_GetAllTechSched(14998): POST - add response to array
12-12 15:33:52.244: I/Async_GetAllTechSched(14998): pre-intent setting
12-12 15:33:52.244: I/Async_GetAllTechSched(14998): post-intent setting
12-12 15:33:52.254: I/Async_GetAllTechSched(14998): dismiss progress
12-12 15:33:52.264: E/JavaBinder(14998): !!! FAILED BINDER TRANSACTION !!!
12-12 15:33:52.274: E/ViewRootImpl(14998): sendUserActionEvent() mView == null

Here is the code that is being executed:

Log.i("Async_GetAllTechSched", "create soap object");
SoapObject request = new SoapObject(svc_NAMESPACE, svc_METHOD_NAME);

Log.i("Async_GetAllTechSched", "create envelope");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
        SoapEnvelope.VER11);

envelope.dotNet = true;
envelope.setOutputSoapObject(request);

Log.i("Async_GetAllTechSched", "create transport");
HttpTransportSE androidHttpTransport = new HttpTransportSE(svc_URL);
androidHttpTransport.debug = true;

try {

    androidHttpTransport.call(svc_SOAP_ACTION, envelope);

    Log.i("Async_GetAllTechSched", "pre SOAP response");

    // use SoapObject instead of SoapPrimitave
    SoapObject response = (SoapObject) envelope.getResponse();

    Log.i("Async_GetAllTechSched", "post SOAP response");

    // get the count of the objects returned
    int cnt = response.getPropertyCount();

    Log.i("Async_GetAllTechSched", "PRE - add response to array");

    // loop through returned object and pull out the strings
    for (int i = 0; i < cnt; i++) {

        // there should always be at least one return value
        sResponse.add(response.getProperty(i).toString());
    }

    Log.i("Async_GetAllTechSched", "POST - add response to array");

} catch (Exception e) {

    e.printStackTrace();

    Log.e("!!ERROR!!", e.getMessage());

    }

    // Log.i("return in async", "*********");
    return sResponse;
}

@Override
protected void onPostExecute(ArrayList<String> result) {



ArrayList<String> arrAllTechSchedule = new ArrayList<String>();

    // get the count prior to the for loop
    int iCnt = result.size();

    //add the result of the web service call to the main scheduling page
    for (int i = 0; i < iCnt; i++) {
        //Log.i("i = ", Integer.toString(i));

        //add the data to a ArrayList so we can add that to the adapter 
        arrAllTechSchedule.add(result.get(i).toString());   
    }       

    // lets launch the main schedule windows

    Log.i("Async_GetAllTechSched", "pre-intent setting");

    Intent intent = new Intent(_Context, ScheduleSelectTech.class);
    intent.putStringArrayListExtra("arrAllTechSchedule", arrAllTechSchedule);
    intent.putExtra("mode", "READ-ONLY");

    Log.i("Async_GetAllTechSched", "post-intent setting");

    // terminate the progress bar
    progress.dismiss();

    Log.i("Async_GetAllTechSched", "dismiss progress");

    //launch the new form
    _Context.startActivity(intent);
}

Once the intent is started it doesn't reach the new activity. I have a LOG.i in the onCreate and that is never hit. The procedure call isnt timing out. When I try this same code with less data being returned I dont get the error. Ie, when I put a SELECT TOP 100 on the statement that is returning the data to the async task its completely fine.

I suppose my question is this - if the data being returned is less than 1MB why is this erring? And if it is because of the 1MB limit, is there something else that I can do to either bypass this limitation or somehow compress the data being returned?

The intended design is that this initial call brings back names and appointments associated with those names (pipe delimited). I display a distinct list of just the names in a spinner (taken from the arraylist). When the user clicks a name in the spinner it will start a new activity that will show all the appointments associated with that name (again, all data coming from the initial arraylist). All the data is being collected in the first async task and just manipulated. This was done to reduce the amount of web calls. This task is doable in 2 web service calls so if that is the answer than that is fine - I was just hoping that there was a different/better way of doing this so I can keep the web service calls limited and reduce user wait time.

Was it helpful?

Solution

is there something else that I can do to either bypass this limitation

Sure. Don't use Intent extras for passing the data. Either:

  • Reorganize this into one activity with multiple fragments, so the data never leaves the activity, or

  • Have the download be done by the activity that needs the data, or

  • Very very carefully use a static data member to get the data from the one activity to the next, taking great pains to avoid memory leaks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top