0

Just wondering what the best way to pass an array list of GeoCodes is?

I can seem to put the arraylist into the intent okay using

saveRouteIntent.putExtra("waypoints", waypoints);

But I cant see how I would get the list in the new activity.

I could build two double arraylists and pass them across and then create the geocode array list again on the other side but im assuming there is a better method?

discodowney
  • 1,279
  • 5
  • 25
  • 48

2 Answers2

1

Use serializable while passing data through putExtra()

First Activity:

ArrayList<String> waypoints= new ArrayList<String>();
saveRouteIntent.putExtra("waypoints", waypoints);

In the other Activity:

ArrayList<String> myList = (ArrayList<String>) getIntent().getSerializableExtra("waypoints");
Jas
  • 3,219
  • 2
  • 14
  • 44
0

If its an array you can use serializable to putExtra() , but in this case you'll have to implement your own subclass that extends BasicNameValuePair , for a perfect implementation try this.

Community
  • 1
  • 1
OBX
  • 5,834
  • 7
  • 31
  • 70