Android File Transfer see my folder(created by app) as a file

I've installed "android file transfer" on mac. My app creates a folder.I can access it using standard file manager in my android device. It shows many folders, including my folder.

But the problem is that "android file transfer" shows me my folder as a file.

Unplugging the device or re-launch of "android file transfer" didn't help.

this is how i create my file:

File folder = new File(Environment.getExternalStorageDirectory().getAbsoluteFile() +File.separator + "myFolder/");

    boolean success = true;
    if (!folder.exists()) {
        success = folder.mkdirs();
    }

and I read that I needed this :

 MediaScannerConnection.scanFile(
            getApplicationContext(),
            new String[]{folder.getAbsolutePath()},
            null,
            new MediaScannerConnection.OnScanCompletedListener() {
                @Override
                public void onScanCompleted(String path, Uri uri) {
                    Log.v("tretretre",
                            "file " + path + " was scanned seccessfully: " + uri);
                }
            });

Can someone help me?

Answers


Late response, but I hope it can help someone.

I had same problem today. Seems that Android File Transfer app is handling last level folder's created by our apps as a file. The only solution that has worked for me is to add a new last level folder inside the original one.

Instead of:

File folder = new File(Environment.getExternalStorageDirectory().getAbsoluteFile() +File.separator + "myFolder/");

Do:

File folder = new File(Environment.getExternalStorageDirectory().getAbsoluteFile() +File.separator + "myFolder/" + "myDummyFolder");

It could also be a hidden folder/file, like .myDummyFolder to avoid display it in file manager apps.


Need Your Help

running all tests post django 1.6

django testing django-testing django-1.6

In django 1.5 and earlier, running python manage.py test would, by default, run all tests in a project (including all those in django.contrib). Subsequent to version 1.6, the default behaviour is t...

HTML 5 keygen example that 'remembers' me?

html5 cryptography public-key-encryption html5-keygen

I remember looking at <keygen> and the one thing I never understood is how to save the results to the client browser? From my understanding it sends you a public key and I should sign somethi...