2

I have created Intent and I put data using putExtramethod.

Now I want to put my geoPointsArraytype variable to my intent object, here is type of geoPointsArray :

List<GeoPoint> geoPointsArray = new ArrayList<GeoPoint>();

In existing methods putExtraI can't find how to put my custom type.

Can someone help me with this?

Thanks

Jovan
  • 4,684
  • 13
  • 64
  • 98

1 Answers1

2

GeoPoint must be Parcelable or Serializable. So you should subclass it to add these functionalities as I think they miss from the original implementation.

Then look into these other questions they will help you. Serialization issue with SortedSet, Arrays, an Serializable

Community
  • 1
  • 1
Pentium10
  • 204,586
  • 122
  • 423
  • 502
  • Do you still need the code, as it is on the linked question. For parcelable just implement the `Parcelable` – Pentium10 Sep 09 '10 at 18:18
  • @Pentium10 can you please give me code for implementing Parcelable for my type. THANKS!! – Jovan Sep 10 '10 at 19:45
  • Just define your GeoPoint class as this:`public class MyGeoPoint implements Serializable` – Pentium10 Sep 10 '10 at 20:06
  • I send mapIntent.putExtra("parc", new MyGeoPoint()); using sendBroadcast(mapIntent); to reciver. In onReceive I get extra using:Serializable prp; prp =intent.getExtras().getSerializable("parc");. Can you please tell me how can I extract this information for use – Jovan Sep 10 '10 at 20:53
  • MyGeoPoint class : public class MyGeoPoint implements Serializable{ int a = 1000; } – Jovan Sep 10 '10 at 20:55