Use apply rather than commit for properties
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/989c58b3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/989c58b3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/989c58b3 Branch: refs/heads/master Commit: 989c58b3b0ed59dc3d0074e6d65c0398ace42165 Parents: 9e0793d Author: Ian Dunlop <[email protected]> Authored: Tue Jul 26 15:51:47 2016 +0100 Committer: Ian Dunlop <[email protected]> Committed: Tue Jul 26 15:51:47 2016 +0100 ---------------------------------------------------------------------- .../taverna/mobile/activities/DashboardMainActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/989c58b3/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java index 911a6f3..b06f44a 100644 --- a/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java +++ b/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java @@ -284,7 +284,7 @@ public class DashboardMainActivity extends AppCompatActivity { if (state) { Toast.makeText(context, "Storage Ready", Toast.LENGTH_SHORT).show(); sp.edit().putString(APP_DIRECTORY_NAME, workflowDirectory.getAbsolutePath()) - .commit(); + .apply(); Toast.makeText(context, "Home dir: " + workflowDirectory.getAbsolutePath(), Toast.LENGTH_LONG).show(); } else { //directory can't be created either because of restricted access or lack @@ -301,7 +301,7 @@ public class DashboardMainActivity extends AppCompatActivity { // Toast.makeText(context, "Directory exists. Home dir: "+workflowDirectory // .getAbsolutePath(), Toast.LENGTH_LONG).show(); sp.edit().putString(APP_DIRECTORY_NAME, workflowDirectory.getAbsolutePath()) - .commit(); + .apply(); /*else { File mainDir = new File(Environment.getExternalStorageDirectory() + File .separator + APP_DIRECTORY_NAME); @@ -314,7 +314,7 @@ public class DashboardMainActivity extends AppCompatActivity { } } else { //use internal memory to save the data File home = context.getDir("Workflows", Context.MODE_PRIVATE); - sp.edit().putString(APP_DIRECTORY_NAME, home.getAbsolutePath()).commit(); + sp.edit().putString(APP_DIRECTORY_NAME, home.getAbsolutePath()).apply(); // Toast.makeText(context, "Home dir: "+home.getAbsolutePath(), Toast // .LENGTH_LONG).show(); }
