Android How to Exit our application when Exit button click
<p>When User click "Exit" button, Its go to device home screen.Then again click/select my application its go to last opened activity.I houldn't go there.It need to  go initial screen.How we can implement this.I have done using :</p>

<pre><code>public void onExitAction(View botton){
    SharedPreferences myPrefs = this.getSharedPreferences("myLogedPrefs",MODE_WORLD_READABLE);
    myPrefs.edit().remove("myLogedPrefs");
    myPrefs.edit().clear(); 
    myPrefs.edit().commit();
    Intent startMain = new Intent(Intent.ACTION_MAIN);
    startMain.addCategory(Intent.CATEGORY_HOME);
    startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(startMain);
    finish();      
}
</code></pre>

<p>Please help me..</p>

<p>Thanks in advance</p>
