Application closes all the activities when click on home key?
<p>Hi Everyone im developing one android application in which there are 7 screens.
when i debug my application it works fine and when i click on home button at 4 screen and again i start my app it starts from same screen/4screen where the app goes into background,but when i create app.apk file for my users and when they use that app and press home key  suppose at 4 screen and he/she restart the  app starts from starting screen that is login screen/1 screen .
Can any buddy tell me whats the problem in it and what can i do to sortout this problem.</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.dblist);
    setTitle("Databases");

    try {
        jsonObj = new JSONObject(getIntent().getStringExtra("key"));
        nameArray = jsonObj.names();
        valArray = jsonObj.getJSONArray("DbList");
    } catch (JSONException e1) {

        e1.printStackTrace();
    }

    ArrayAdapter&lt;String&gt; dbName = new ArrayAdapter&lt;String&gt;(this,
            android.R.layout.simple_list_item_1);

    for (Integer i = 0; i &lt; valArray.length(); i++) {

        try {
            String obj = valArray.getJSONObject(i)
                    .getString("DataBaseName").toString();
            dbName.add(obj);
        } catch (JSONException e) {

        }

    }
    setListAdapter(dbName);
}


@Override
protected void onResume() {

    super.onResume();

    // versionUpdate();

    Logout lo = new Logout();
    lo.Check();
    processThreadLogoutTime();

}

final Handler handler = new Handler() {

    @Override
    public void handleMessage(Message msg) {

        super.handleMessage(msg);

        int compareTime = 1;

        if (diff &gt;= compareTime) {

            Intent intent = new Intent(ShowDbList.this, LoginActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);

        }

    }

};

protected void processThreadLogoutTime() {

    new Thread() {

        public void run() {

            cw = new ConnectToWebService();
            getMethod gm = getMethod.GetApplicationDetails;
            String result = cw.getUrl("", gm);
            String urlLogoutTime = result.replaceAll(" ", "%20");
            cw.LogoutTime(urlLogoutTime);
            Logout logout = new Logout();

            diff = logout.LogoutFun();

            handler.sendEmptyMessage(0);

        }

    }.start();

}

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {

    String item = (String) getListAdapter().getItem(position);
    Entities.DataBaseName = item;
    try {
        String webAdmin = valArray.getJSONObject(position)
                .getString("WebAdmin").toString();
        Integer uId = Integer.parseInt(valArray.getJSONObject(position)
                .getString("UserID"));
        Entities.webAdmin = webAdmin;
        Entities.userId = uId;
    } catch (JSONException e) {
        // TODO Auto-generated catch block

    }
    Intent intent = new Intent(v.getContext(), Menu.class);
    startActivity(intent);

}
</code></pre>
