diff --git a/MapEver/src/de/hu_berlin/informatik/spws2014/mapever/Start.java b/MapEver/src/de/hu_berlin/informatik/spws2014/mapever/Start.java index d036ddb..0fbeb95 100644 --- a/MapEver/src/de/hu_berlin/informatik/spws2014/mapever/Start.java +++ b/MapEver/src/de/hu_berlin/informatik/spws2014/mapever/Start.java @@ -114,6 +114,17 @@ protected void onCreate(Bundle savedInstanceState) { Log.d("Start", "onCreate..." + (savedInstanceState != null ? " with savedInstanceState" : "")); super.onCreate(savedInstanceState); + // We do not want to have multiple instances, as that ends up with race + // conditions on reading/writing the data files. + // Using singleTask for this is simply broken. + // So instead forward the intent to a "clean" task if necessary + if (!isTaskRoot() && (getIntent().getFlags() & (Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK)) == 0) { + getIntent().setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(getIntent()); + finish(); + return; + } + if (savedInstanceState == null) { Intent intent = getIntent(); if (intent != null && intent.getBooleanExtra(INTENT_EXIT, false)) {