I have the following line of code
intent.putExtra("connectionAddress", connectionManager.connectionAddress);
connectionAddress
is in fact an InetAddress
. I cannot figure out the appropriate method to 'get..
' this. I suspect I need to cast it to another type and back again? In which case what would be the best approach?
I need to ensure I still have the information needed to create a DatagramSocket
in the next activity.
You need to get the address from the intent as a serializable extra, then cast it back to InetAddress
.
InetAddress address = (InetAddress)intent.getSerializableExtra("connectionAddress");