From ee528a93f8de68b2d56f1e90e088eddcd81aaa19 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Mon, 12 Nov 2012 10:09:56 +0100 Subject: [PATCH] Allow the file chooser to preserve the current path across device orientation changes. --- .../android-tutorial-5/src/com/lamerman/FileDialog.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); + } + } -- 2.7.4