onBackPressed button my application not properly close. Its again registered my application in background. Its not properly close from background.please tell me how can I close properly
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Do you want to exit from application ?");
builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
prefProviderWrapper.setPreferenceBooleanValue(PreferencesWrapper.HAS_BEEN_QUIT, true);
moveTaskToBack (false);
Context context= getApplicationContext();
Communicator comm= new Communicator(context);
Activity app=getParent();
comm.CloseApplication(app);
finish();
}
});