I’ve read that if we want to save any data when activity is restarting (rotating device), we have to store all data in Bundle’s saveInstanceState().
But, if we want to save big data structure in bundle – it freezes system and increases memory usage.
For example:
I have a HashMap of 50,000,000 elements. The reading is from SD card. So, if I save HashMap to Bundle – it freezes the rotation of device for a very loooooong time.
Is there a way, in which we can save data without storing in Bundle? (save the pointer to HashMap for example?)
You definitely shouldn’t do this. You should handle orientation changes manually or keep this data out of your activity, like in a Service.