What happens is that your application get's killed and all the data which
was entered is refreshed or removed.
You could use SharedPreference to store data which can be retrieved again at the time of opening the application.
I suggest you to save the user name and password entered onPause() or on onDestroy() and reproduce it back on onCreate() (if any).
Setting values in Preference:
// MY_PREFS_NAME - a static String variable like:
//public static final String MY_PREFS_NAME = "MyPrefsFile";
SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
editor.putString("name", "xyz");
editor.putString("password","abc");
editor.commit();
Retrieve data from preference:
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
String restoredText = prefs.getString("text", null);
if (restoredText != null) {
String name = prefs.getString("name", "No name defined");//"No name defined" is the default value.
String password= prefs.getString("idName", "No name defined");
}
EDIT
If you want a particular activity to open first in an application, you need to register it in the AndroidManifest.xml using:
<activity android:name=".put your started activity name here"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Register your password screen here and it will open whenever you open your application.
And if you don't want to change your launch application and just want to send it to another activity, I suggest you to use intents.
Intent i = new Intent(Source.java, Destination.class);
startActivity(i);
finish();