-1

My app downloads a file to my Android tablet. I can see the file on my tablet, but I can't find the file using my computer's file manager.

A response to another Stack Overflow question says the file manager may need "root privileges," but I don't know how to give a file manager root privileges or download a file manager that has root privileges. Is that possible? A second answer to that same question mentions some way to transfer the file using the command line, but I haven't been able to figure out how to do that.

I need to be able to transfer the file to my computer. What is the easiest way to do this?

void newFile() {
    try {
        File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "file.txt");
        FileOutputStream fos = new FileOutputStream(file);
        String myInputText = "I really hope this works!";
        fos.write(myInputText.getBytes());
        fos.close();
        System.out.println("My file is at " + file.getAbsolutePath());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Community
  • 1
  • 1
Olivia Watkins
  • 526
  • 1
  • 6
  • 17
  • Do you download to the external storage? You only require root privilidges to `/data` and `/system`, for example – OneCricketeer Jan 12 '16 at 18:01
  • 'I can see the file on my tablet'. Please explain how you do that. What is the full path? – greenapps Jan 12 '16 at 18:03
  • https://stackoverflow.com/questions/10643476/sdcard-content-exist-but-cant-see-them/10643609?s=2|2.3489#10643609 Beyond that, please provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) demonstrating your problem. In this case, that would be the source code that you are using to save the file on your Android device. – CommonsWare Jan 12 '16 at 18:03
  • Printing out the path using `getAbsolutePath()` said the file was saved at /storage/emulated/0/Download/file.txt. I can view the file through my tablet's text editor app. – Olivia Watkins Jan 12 '16 at 18:07
  • @cricket_007, I think I am downloading to external storage because I choose the file's directory using `Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)`. – Olivia Watkins Jan 12 '16 at 18:10
  • What operating system are you using? Have you installed the drivers for your device? Can you browse any files on your tablet from the computer? For reference, if I plug my Android device in, I can clearly see the Download directory in the first window... – OneCricketeer Jan 12 '16 at 18:14
  • I'm using Windows, and I have installed the driver. When I plug in my tablet, I see a lot of folders (Downloads, Pictures, etc.) On my computer, I can view all the photos taken on the tablet and all of the files I downloaded onto it. I just can't see the files created by the app. – Olivia Watkins Jan 12 '16 at 18:36

1 Answers1

0

If you familiar with Linux Operating system, that you can use command line to chmod the file privilege. But I think if you can move this file in your tablet, maybe try to transfer it by Blue tooth, email is much easier.

Xinbo
  • 26
  • 2