Search code examples
androidarraysdatabaseandroid-bundleandroid-binder

putExtra: How should I handle large arrays? Database or split to smaller arrays?


I like to know what of following ideas makes more sentence:

I have three Arrays with more than 5'000 entries. And when I try to put them into Extra, I became the FAILED BINDER TRANSACTION:

  1. Split those big arrays into smaller and give them to the next activity by putExtra

  2. Save those entries to a database and work with sqllite and cursor?

Thanks in advance!


Solution

  • I would choose the second case. Imagine that for some reasons, you have to create more than 3 arrays, would you really split them into smaller, modify the code where you pass them to the next activity ? Imagine now that you have to access to this entries for another activity, you will have to re-implement this stuff. This isn't maintanable.

    I don't think this is really judicious to use extras for such stuff. By creating a database you will be able to :

    1 - Stock important datas
    2 - Access them everywhere

    So I would create entries in a database.