- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- TCL LCD és LED TV-k
- Audiofil és gamer? Az ASUS megpróbálja
- DUNE médialejátszók topicja
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
- Milyen monitort vegyek?
- Milyen notebookot vegyek?
- Melyik tápegységet vegyem?
- Intel Core i7 9xx "Bloomfield" (LGA 1366)
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
Új hozzászólás Aktív témák
-
SektorFlop
aktív tag
Sziasztok!
Már jó rég jártam itt, viszont most nagyon csúnyán elakadtam egy egyszerű dologgal. Van egy egyszerű kódom, ami lementene egy fájlt belső van külső tárhely /Android/data/... mappájába. 10 telefonból 9-en működik. A kivétel egy Huawei Y6 (Android 5.1.1, EMUI 3.1) Valakinek volt hasonló problémája? Vagy esetleg megoldást tud rá valaki?
A leegyszerűsített program rész:
public void createFile(TextView textView){
String filepath ="/storage/sdcard1/Android/data/com.example.app/route.txt";
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filepath);
byte[] buffer = "Ez lesz írva a fájlba".getBytes();
fos.write(buffer, 0, buffer.length);
fos.close();
textView.setText("Saved");
} catch (FileNotFoundException e) {
e.printStackTrace();
textView.setText(e.toString());
} catch (IOException e) {
e.printStackTrace();
textView.setText(e.toString());
}finally{
if(fos != null)
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
textView.setText(e.toString());
}
}
}Manifestben következő permissionok:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />11-08 09:18:52.442 6957-6957/com.mobilengine.filesavetest W/System.err: java.io.FileNotFoundException: /storage/sdcard1/Android/data/com.example.app/route.txt: open failed: EACCES (Permission denied)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.IoBridge.open(IoBridge.java:494)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.mobilengine.filesavetest.MainActivity.createFile(MainActivity.java:36)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.mobilengine.filesavetest.MainActivity.onCreate(MainActivity.java:27)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.Activity.performCreate(Activity.java:6102)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.access$1200(ActivityThread.java:165)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.os.Looper.loop(Looper.java:135)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5593)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.lang.reflect.Method.invoke(Native Method)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.Posix.open(Native Method)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.IoBridge.open(IoBridge.java:480)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: ... 18 more
Új hozzászólás Aktív témák
- Lenovo Thinkpad P1 Gen 6 - i9-13980HX, 32GB, 2TB SSD, 16" WQUXGA (3840 2400), RTX 4090
- BESZÁMÍTÁS! ASRock B550 R5 5600X 16GB DDR4 512GB SSD RTX 3070 8GB Zalman Z1 PLUS Cooler Master 650W
- í kilenc! AKCIÓS PRECÍZIÓS KÉSZÜLÉK! 7560 i9-11950H 64GB RAM 1TB SSD Nvidia RTX A3000 6GB 1 év gar
- GYÖNYÖRŰ iPhone 14 Pro Max 128GB Space Black - 1 ÉV GARANCIA -Kártyafüggetlen, MS4332
- utolsó - Dell Alienware 18 Area-51 AA18250 18" - Intel Core Ultra 9 275HX, 64GB, 2TB SSD, RTX 5090
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


