Start shortcuts with singleTop, but not all launches

This will prevent shortcuts from creating many views, and causing
them to leak. However, do not use singleTop for all launches
of the view activity, else the edit mode cannot be entered.
This commit is contained in:
Branden Archer
2017-11-25 14:22:42 -05:00
parent ec17255a43
commit c733a6c3b9
2 changed files with 10 additions and 1 deletions

View File

@@ -322,6 +322,9 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
{
Intent shortcutIntent = new Intent(this, LoyaltyCardViewActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
// Prevent instances of the view activity from piling up; if one exists let this
// one replace it.
shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
Bundle bundle = new Bundle();
bundle.putInt("id", id);
bundle.putBoolean("view", true);