Hello,
I am new to Android development and fooling around with some sample programs to get better acquainted with it.
One of the tutorial books I read recommended writing a class to extend the Application class for easy access to shared preferences and things.
My application includes a login screen and I have my application class handling all the login/logout methods (don't know if this is the best way to do it, but that’s a different issue I guess). In my logout method I created an intent to open the Login screen activity after the user logs out and got the error: "android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?"
I know how set the flags to fix this, but I was wondering if this is bad practice. I could guess at why it might be bad to do but I don’t really have a deep enough understanding to know for sure.
Should I only start activities from inside other activities or is it ok to do something like this? If not, why exactly?
Thanks