Adroid: getExternalStorageDirectory is not necessarily the external storage SdCard, adroidsdcard

Source: Internet
Author: User

Adroid: getExternalStorageDirectory is not necessarily the external storage SdCard, adroidsdcard

Prerequisites: My testing machine is Huawei honor 6. I installed a 16 GB memory card.
For the interview, one of my demonstration projects uses the android local WebService. However, when the webService is deployed locally, an error is reported on how the application obtains data. Only a few returned strings are correct. After checking the code, the normal part returns the string directly. Some of the exceptions occur when reading files.
First of all, I thought about whether there is a problem with the reading part of the code. I set up a demo project to read SDcard, but how can I handle it? open failed: ENOENT (No such file or directory) errors, and then try to create a folder and path to see if the existing SdCard will be overwritten. However, there is no change.


Try to find the same file path. I actually found the file, and at the bottom I found the file I just created with a size of 0 kb. As a result, I can infer that getExternalStorageDirectory does not obtain the external storage SDCard I want. I found that the so-called internal storage is also SDCard, but it is the default.
To solve the webServie resource access problem, I used the 360 mobile assistant to import the resource on the computer to SdCard0.
It took 4-5 hours to bend the curve, so it was really tiring.
Bed in the morning, turn on the computer and start genymotion, and the problem occurred for a whole morning. uxtheme was replaced (but it could not be covered ), run the command to change to the compatible mode (both of them have been tried and are not available). virtualBox cannot be changed to 4.3.12. You have to stop the treatment. Use the built-in android studio.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.