diff options
author | Xavi Artigas <xartigas@fluendo.com> | 2012-11-12 10:09:56 +0100 |
---|---|---|
committer | Xavi Artigas <xartigas@fluendo.com> | 2012-11-12 10:09:56 +0100 |
commit | ee528a93f8de68b2d56f1e90e088eddcd81aaa19 (patch) | |
tree | 4bf0eed0857cbf77ee3756d756d7b4835e26a29b | |
parent | 636a0843b62722952e7f13cb45f95b8964e6e372 (diff) |
Allow the file chooser to preserve the current path across device orientation changes.
-rw-r--r-- | gst-sdk/tutorials/android-tutorial-5/src/com/lamerman/FileDialog.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gst-sdk/tutorials/android-tutorial-5/src/com/lamerman/FileDialog.java b/gst-sdk/tutorials/android-tutorial-5/src/com/lamerman/FileDialog.java index fc56383..e2ef765 100644 --- a/gst-sdk/tutorials/android-tutorial-5/src/com/lamerman/FileDialog.java +++ b/gst-sdk/tutorials/android-tutorial-5/src/com/lamerman/FileDialog.java @@ -137,7 +137,12 @@ public class FileDialog extends ListActivity { }); - String startPath = getIntent().getStringExtra(START_PATH); + String startPath; + if (savedInstanceState != null) { + startPath = savedInstanceState.getString("currentPath"); + } else { + startPath = getIntent().getStringExtra(START_PATH); + } startPath = startPath != null ? startPath : ROOT; getDir(startPath); @@ -320,4 +325,10 @@ public class FileDialog extends ListActivity { } } + @Override + protected void onSaveInstanceState(Bundle outState) { + outState.putString("currentPath", currentPath); + super.onSaveInstanceState(outState); + } + } |