I am trying to send an array of objects to a new intent, but the problem is that I don't know how to send the whole array at once. The method I managed to get it working is adding object by object, in a for loop, and in the second activity I have to get them one by one, something like this:
Main activity:
        Intent newIntent = new Intent(mainA.this, secondA.class);
        for(int i=0;i<numberOfObjects;i++)
            newIntent.putExtra("object"+i,myObjects[i]);
        newIntent.putExtra("length", x);
        startActivity(newIntent);
Second activity:
        Serializable n = getIntent().getSerializableExtra("length");
        int x = Integer.parseInt(n.toString());
        myObjects = new objClass[x];
        for(int i=0;i<x;i++)
            myObjects[i] = (objClass) getIntent().getSerializableExtra("object"+i);
Even if this method works, and gets me the right results, isn't there a better/faster/cleaner solution?(I searched a lot, but haven't found a better way, maybe I don't know what exactly to look for).
 
     
    