What to do on TransactionTooLargeException

前端 未结 30 3762
盖世英雄少女心
盖世英雄少女心 2020-11-22 03:08

I got a TransactionTooLargeException. Not reproducible. In the docs it says

The Binder transaction failed because it was too large.

D

30条回答
  •  无人共我
    2020-11-22 03:48

    I got this in my syncadapter when trying to bulkInsert a large ContentValues[]. I decided to fix it as follows:

    try {
        count = provider.bulkInsert(uri, contentValueses);
    } catch (TransactionTooLarge e) {
        int half = contentValueses.length/2;
        count += provider.bulkInsert(uri, Arrays.copyOfRange(contentValueses, 0, half));
        count += provider.bulkInsert(uri, Arrays.copyOfRange(contentValueses, half, contentValueses.length));
    }
    

提交回复
热议问题