W/System. Err: Java. IO. FileNotFoundException:/storage/emulated/0/demo/demo_test. TXT: open failed: EACCES (Permission denied)
W/System. Err: at libcore. IO. IoBridge. Open (496) IoBridge. Java:
The at Java. IO. FileInputStream. & lt; init> (a FileInputStream. Java: 159)
At com. Average. ImportSDKDemo. MainActivity $OnClick. OnClick (Unknown Source: 68)
An android. View. The view. PerformClick (the Java: 7185)
An android. View. The view. PerformClickInternal (the Java: 7162)
An android. View. The view. The access of $3500 (819) view. Java:
An android. View. The view $PerformClick. Run (27684) view. Java:
An android. OS. Handler. HandleCallback (Handler. Java: 883)
An android. OS. Handler. DispatchMessage (Handler. Java: 100)
. An android OS. Stars. Loop (224). Which Java:
. An android app. ActivityThread. Main (7562) ActivityThread. Java:
The at Java. Lang. Reflect. Method. Invoke (Native Method)
At com. Android. Internal. OS. RuntimeInit $MethodAndArgsCaller. Run (539) RuntimeInit. Java:
At com. Android. Internal. OS. ZygoteInit. Main (ZygoteInit. Java: 950)
Under Caused by:. The android system. ErrnoException: open failed: EACCES (Permission denied)
W/System. Err: at libcore. IO. Linux. Open (Native Method)
The at libcore. IO. ForwardingOs. Open (ForwardingOs. Java: 167)
The at libcore. IO. BlockGuardOs. Open (BlockGuardOs. Java: 252)
The at libcore. IO. ForwardingOs. Open (ForwardingOs. Java: 167)
W/System. Err: at the android app. ActivityThread $AndroidOs. Open (7461) ActivityThread. Java:
W/System. Err: at libcore. IO. IoBridge. Open (482) IoBridge. Java:
I on the large xinjiang SDK application development, at present the test problem is: I need to read the files from the mobile phone, using the File read class, again by InputFileStream read into the input stream, to extract the internal data for application of the above error details,
The core code is as follows:
The Manifest file permissions the application:
Read the code:
The File File=new File (Environment. External.getexternalstoragedirectory () +
"/demo/demo_test. TXT");
Toast. MakeText (getApplicationContext (), the file canRead ()? "True" : "false",
Toast. LENGTH_SHORT). The show ();
Try {
FileInputStream inputStream=new FileInputStream (file);
Byte [] temp=new byte [98].
While (inputStream. Read (temp)!=1) {
The d (" DATA ", new String (temp));
}
} the catch (IOException e) {
e.printStackTrace();
}