What is the best way to store a non serializable object instance in android?
<p>i have a class that inherits from BroadcastReceiver and is bound to listen for PHONE_STATE events. inside of the onReceive method, i need an object instance that has to be always the exact same (at least between the state ringing and the next occurrence of ide / offhook). that means i need to store the object somewhere. it can not be serialized nor anyhow be stored in a database or in the SharedPreferences.</p>

<p>i thought about 2 different approaches:</p>

<ol>
<li>using a static variable. downside: no one knows at which point android is going to delete it.</li>
<li>using a service. downside: the service needs to be started at the first call and then bound. this is an async call and i might have to wait for an uncertain time. also it seems kinda wrong to use a service just to store one single object.</li>
</ol>

<p>any other, better ideas?</p>
