The problem is that I want to restrict the access to the desistalacion of an app, when the user goes into configuration-> application-> app, mediately displays an activity requesting passwors with two buttons, check and cancel, the objective is that when I press cancel the activity and the setting application activity, this is the code I use but only the password activity closes.
cerrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
finish();
}
});