Allow the file chooser to preserve the current path across device orientation changes.
This commit is contained in:
parent
636a0843b6
commit
ee528a93f8
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user