spanesso / android-file-dialog

Automatically exported from code.google.com/p/android-file-dialog
0 stars 0 forks source link

rotate the screen, the loacation come back to START_PATH #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. open the filedialog with the START_PATH: /
2. select a directory, such as /etc
3. rotate the screen, the loacation come back to START_PATH

What is the expected output? What do you see instead?
The location should keep the same when the screen was rotated.
I see the loaction come back to START_PATH instead.

What version of the product are you using? On what operating system?
I found this problem in android 2.1, 2.2

Please provide any additional information below.
to fix this problem, the onPause method should be overrided.

    @Override
    protected void onPause() {
        String myPathStr = myPath.getText().toString();
        int idx = myPathStr.lastIndexOf(':');
        String currPath = myPathStr.substring(idx + 2);
        getIntent().putExtra(START_PATH, currPath);
        super.onPause();
    }

Original issue reported on code.google.com by stevens...@gmail.com on 1 Aug 2011 at 12:49

GoogleCodeExporter commented 9 years ago
ok, thanks a lot :)
I'll try to add your fix in near time

Original comment by alexande...@gmail.com on 2 Aug 2011 at 5:28

GoogleCodeExporter commented 9 years ago
Most likely the bug will be fixed today

Original comment by alexande...@gmail.com on 18 Aug 2011 at 6:38

GoogleCodeExporter commented 9 years ago
You should onRetainNonConfigurationInstance() and not use onPause().

Submitting patch.

Original comment by twig.ngu...@gmail.com on 10 Feb 2012 at 9:03

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed it using the following code on FileDialog.java:

@Override
    public void onSaveInstanceState(Bundle savedInstanceState) {
        super.onSaveInstanceState(savedInstanceState);

        savedInstanceState.putString("CurrentPath", currentPath);

    }

    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);

        currentPath = savedInstanceState.getString("CurrentPath");

        getDir(currentPath);

    }

Original comment by brunomac...@gmail.com on 26 May 2013 at 6:54