Reputation: 55
I'm using a static method and some static member variables related to that in a class, I have read that there is a chance that these static variables may reset at some point of time. My question is that is it assured that the app will starts from Application's onCreate()
if something like this happens.
Thanks.
Upvotes: 1
Views: 625
Reputation: 1
You need to restart your application to reinitialise static variables
Intent mStartActivity = new Intent(context, StartActivity.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(context, mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
System.exit(0);
Upvotes: 0
Reputation: 459
As far as I know static variables only resets at the time when application restarts otherwise they remains same all over the app
Upvotes: 1