Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5943467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:23:59+00:00 2026-05-22T16:23:59+00:00

I have used shared preference for session maintaining in my application. And storing userId

  • 0

I have used shared preference for session maintaining in my application. And storing userId and password in Shared preference .
How to clear these data when I exit from my application. Because when I restart my application It will give the previous session.
When I log out in my application and again start app it will work nicely. In logout I have made the shared preference data (userId and password) as null. but I want to clear all these data in application exit.

I have also used below permission in manifest file: “android.permission.CLEAR_APP_USER_DATA”

<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA"></uses-permission>

But I dont know how to use them in coding.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:24:00+00:00Added an answer on May 22, 2026 at 4:24 pm

    I have used shared preference for session maintaining in my application.

    Do not do that. Use static data members for “session” data and use shared preferences for persistent data.

    How to clear these data when I exit from my application .

    There is no concept of exiting an application in Android any more than there is a concept of exiting an application on the Web.

    If you use static data members for your session data, the data will automatically be cleared when Android terminates the process, which it will do as a matter of course when the application has been abandoned for a significant period of time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an activity where i have used shared preferences for storing data..now
In Python specifically, how do variables get shared between threads? Although I have used
I have just changed my WPF application from .Net3.5 to .Net4. Doing this caused
Let's say I have a container (std::vector) of pointers used by a multi-threaded application.
I have a shared project (C#) used by several other projects. In VS2008, everything
Possible Duplicate: Can I access session state from an HTTPModule? I have set up
I have a shared reporting dll that is used in both windows and web.
I have a user preference in my app, which gets used by different activities.
We are developing an application in android,We have to save some lists and data
I have used traditional version control systems to maintain source code repositories on past

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.