Skip to content

Instantly share code, notes, and snippets.

@amitshekhariitbhu
Created May 6, 2016 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitshekhariitbhu/4ae420fc35c60f503f0a863d882b98b2 to your computer and use it in GitHub Desktop.
Save amitshekhariitbhu/4ae420fc35c60f503f0a863d882b98b2 to your computer and use it in GitHub Desktop.
// Write this in onBackPress of your MainActivity
public class MainActivity extends AppCompatActivity{
@Override
public void onBackPressed() {
super.onBackPressed();
// This is important : Hack to open a dummy activity for 200-500ms (cannot be noticed by user as it is for 500ms
// and transparent floating activity and auto finishes)
startActivity(new Intent(this, DummyActivity.class));
finish();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment