btnReturn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i=new Intent(this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } )};