Q:

Passing an ArrayList of LatLng through intent

Right now, I know how to send an ArrayList of Strings through intent by doing this to send:
Intent intent = new Intent(MainActivity.this, MapActivity.class);
intent.putStringArrayListExtra("list", list);
startActivity(intent);

and this to receive:
Intent i = getIntent();  
ArrayList<String> list = i.getStringArrayListExtra("list");

But I want to send an ArrayList of LatLngs, like this:
Intent intent = new Intent(MainActivity.this, MapActivity.class);
intent.putLatLngArrayListExtra("listLatLng", listLatLng);
startActivity(intent);
\\pseudo code, obviously

and then:
Intent i = getIntent();  
ArrayList<String> list = i.getLatLngArrayListExtra("listLatLng");
\\pseudo code, obviously

Any ideas on how to do this? Is there any easy way or do I have to modify something? Thanks.

A:

I would use android.location;  It extends Parcelable and you can easily create and store the Locations in an arrayList created from lat and lon values
Intent i = new Intent(MainActivity.this, MapActivity.class);
         i.putParcelableArrayListExtra(name, value);

