Allow the file chooser to preserve the current path across device orientation changes.

This commit is contained in:
Xavi Artigas 2012-11-12 10:09:56 +01:00
parent 636a0843b6
commit ee528a93f8

View File

@ -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);
}
}