I’m developing a simple app in which I want to maintain a session in all the activities until the user logs out. I am new to android so please give me good explanations or webside references or any other stuff for session maintaining.
Thank you.
I’m developing a simple app in which I want to maintain a session in
Share
you can use the Application class in you activity. By extending the Application class you can maintain the state in android throughout the application. It means you can call those variables in the application in all the activity.
by using this code you can set and get the username and password in any activity. And maintain the state of your username and password.
Just you need to add the class name in the manifest.xml like this way.
You can access you application variables with static getters and setters from any activity or service. :
Hope you get your answer by this sample.