Application level variables in android getting nulled
<p>I have developed an Android Application. To keep the user logged in, I am storing their username and password in a class that extends <code>Application</code>. If the user exits the application without logging out, a backgound service will start which will use the user credentials (username and password) stored in the Application context. <br><br>This worked very well for me. But now I have installed facebook in my phone (Samsung galaxy Ace). It has a service that occupies 37 MB of the RAM. Now when I run the background service of my application. The application level variable get killed when I play a game or sometimes even when I lock the screen (the username and password become null).<br>
What is happening? What other way is there to keep the user logged in? I don't want to use sqlite database to store the username/password. You can easily see the values of the table.
<br>
<br>
<strong>Note</strong><br>
I still have 38 MB of RAM available even with this facebook running. my app uses only 544kb of memory.</p>

<p><strong>EDIT1</strong><br>
This might seem surprising but I have not made any changes in my code. But now the Apllication variables (username and password) lives on even when I open threee or four applications. In the question above I said that the <code>Application</code> vairables become null as soon as I even lock the screen. But now they seem to be persisting even when I play play a game (with another application open!). So clearly it not the memory constraint that kills the <code>Application</code> variables. <br>
What is the reason for this? What determines the killing of the application level variables?</p>
