This is a very simple question, I am implementing a kind of Singleton pattern in my main activity , obviously it is not well implemented and not working as expected, but I will like to know more in detail why.
This is my code:
public class UIthread extends SherlockFragmentActivity implements
WsP12GetDocPendantToSign.OnCallbackFunction{
private static final String TAG = "UIthread";
//mode
private static UIthread instance;
....
public static UIthread getInstance() {
return instance;
}
protected void onCreate(Bundle savedInstanceState) {
if (instance == null)
instance = this;
super.onCreate(savedInstanceState);
instance.initialize();
}
When I close my app and re-run, the instance still alive and the application has problems, so the instance is not being deleted when I close the app the first time, I will be very grateful if someone can explain why the instance still alive.
Thanks!