when I declare and initialize a variable as static in my main activity and the activity gets destroyed. Can I still access the content of the variable?
For example t
Once I have developed the application using lots of static vars, The problem with static vars is that once android has low memory it automatically removes the static variable and if your views are connected with static variable it won't show or worse application will crash. I recommend using shared preferences or other methods to store the variables.
problems
If your android memory is low the static variables will be removed from ram and you have to reinitialize them
If your view is attached to the static variables like ArrayList to recycler view it will throw errors like null pointer exceptions for that you have to check balance every time you initialize the view.
The main problem is of your variable is too big like ArrayList with images in it some time it can give out of memory exception