lordmegamax lordmegamax - 2 years ago 98
JSON Question

Transferring large amounts of data to Activity using putExtra();

The application passes large number of objects (about 150 objects after parsing

format) via

Among them are
And the process of opening a new activity takes about 2 seconds...
Is there a way to speed up this process?

Answer Source

If you just want to pass data from one activity to another you can just use a static variable that is accessible from both activities. This eliminates the need to serialize and deserialize all the objects. Example:

public class Globals {
    public static List<MyObject> myObjects;

In one activity you can set the data you want to pass in Globals.myObjects and the receiving activity can get it from there.

Be aware that this mechanism does have some drawbacks (like when Android kills your process and restarts it later). However, this can be the least troublesome way to simply hand a lot of objects from one activity to another.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download