summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xartigas@fluendo.com>2012-11-12 09:09:56 (GMT)
committerXavi Artigas <xartigas@fluendo.com>2012-11-12 09:09:56 (GMT)
commitee528a93f8de68b2d56f1e90e088eddcd81aaa19 (patch)
tree4bf0eed0857cbf77ee3756d756d7b4835e26a29b
parent636a0843b62722952e7f13cb45f95b8964e6e372 (diff)
downloadgst-sdk-tutorials-ee528a93f8de68b2d56f1e90e088eddcd81aaa19.tar.gz
gst-sdk-tutorials-ee528a93f8de68b2d56f1e90e088eddcd81aaa19.tar.xz
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.java13
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);
+ }
+
}