I need to send an intent where data might be large. Since it's not possible to send intent larger than 500kb, I'd like to know the size, but there isn't any sizeof in java, how can I check the size before to send or to reduce the size?
Asked
Active
Viewed 847 times
0
-
Intent size has a limit, I belive was 1MB in froyo. I think the easiest way was to save on a file while passing the information to other activity or implementing a singleton. – Luis Pereira Oct 26 '15 at 08:09
-
http://stackoverflow.com/questions/12496700/maximum-length-of-intent-putextra-method-force-close – IntelliJ Amiya Oct 26 '15 at 08:10
1 Answers
0
Rather than sending data using intent declare another class "Data" to store values with static variables and use them whenever you want.
-
1This assumes local usage and is even then bad practice (despite it being part of Android Studio's template library), see eg. http://stackoverflow.com/questions/9541688/static-variable-null-when-returning-to-the-app there is another (that I've since lost) SO Q&A where the steps to force this *involuntary* nulling are described. – John Oct 26 '15 at 08:17
-
we can save data using activity onSaveInstanceState() so then what will be the problem? – Oct 26 '15 at 08:22