I defined a public variable Username which is used in 4 other activities (Activity A, Activity B, Activity C and Activity D). I know this is not the correct way to pass data between activities and I noticed that after a certain time the variable is becoming null.
My first question would be, why does Username lose its value after a certain period of time (e. g. I unlock the device after 6 hrs and get null reference exception where Username is passed as an argument to a method).
Second question is, how should I pass Username between activities. Should I PutExtra when starting each new activity or there's a better way to do it? My activities are execute in following order: Act A --> Act B --> Act C --> Act D. That means I pass Username 3 times between activities?