Close an Android Application

To close an android application  & go back to user first home screen try to use below code:


 Intent startMain = new Intent(  
 Intent.ACTION_MAIN);  
 startMain.addCategory(Intent.CATEGORY_HOME);  
 startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
 startActivity(startMain);  
 System.exit(0);  
 android.os.Process.killProcess(android.os.Process.myPid());  
First