This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Lists data passed in Bundle returns empty  RSS feed

Posts: 18
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to pass few lists of values into a fragment through Bundle. However I have done the same before without any problems. It looks so silly - I can't figure out why the size of lists are shown 0 when we retrieve the bundle in fragment.



The part where I am putting data into Bundle. The size of `countriesFromBundle` is more than 0.


And this is where I am getting the empty lists, like for ex. the size of `countriesList` is 0.

Saloon Keeper
Posts: 1817
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You appear to be passing a fair amount of data around and this is not recommended

Android API wrote:For the specific case of savedInstanceState, the amount of data should be kept small because the system process needs to hold on
to the provided data for as long as the user can ever navigate back to that activity (even if the activity's process is killed).
We recommend that you keep saved state to less than 50k of data.

I think that the better solution would be to store the data in a database and then pass the primary key around.
Or possibly store the data in some temporary file and then access that data when you need/want to.

I know that there is a hard limit to the amount of data that you can send in a bundle around,
but I'm not too sure what it is as there are some conflicting reports out there.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!