In the first activity the user is asked for an ip-address and a port.
A socket gets opened using this info, an if the connection could be established another activity gets active in which I want to use this socket object.
Now, how to share this object in a global context, to get access to it?
Open and manage this socket in a Service. That way you’ll be able to manage its lifecycle separately from the Activities.