socket gets destroyed every time I rotate the phone
<p>I'm working with sockets but every time a rotate the phone to the horizontal position my socket get destroyed as the activity is recreated. I guess this is because I destroy the socket in the onStop() function. </p>

<p>Until now I'm using:</p>

<pre><code>@Override
protected
void onSaveInstanceState( Bundle data ) {
    data.putInt( "Phase", 3 );       
}
</code></pre>

<p>to store some integers but I don't know how to store a socket and even if I would, that wouldn't avoid the socket from being destroyed upon changing phone orientation.</p>

<p>Any ideas?</p>
