How to access the Map from another Activity . Cookies are needed for requests from another Activity when using Jsoup.connect .
Tried to use Intent.putExtra , but objects of type Map cannot be transferred, serialization does not work. What am I doing wrong?

Please provide a brief visual example of the code from 2 Activities.

 Connection.Response res = Jsoup.connect("").data("", "").method(Connection.Method.POST).execute(); Map<String, String> Cookies = res.cookies(); 
  • Map is an interface, not a class, it cannot be serialized. You need to use some kind of interface implementation, for example, HashMap - it is serialized and transmitted via the intent. In general, you cannot get your cookies into this interface either. - pavlofff

1 answer 1

There are two solutions to the problem:

  1. Make the Map a public static variable and directly access it from another B.Cookies... ( B.Cookies... ). Initial solution proposed here.

  2. Use a bundle wrapper to transfer an object: https://gist.github.com/mmarcon/6660453