Ú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
- Beépített hangszórót is kapott az MSI legfrissebb mini PC-je
- One mobilszolgáltatások
- Luck Dragon: Asszociációs játék. :)
- Fejhallgató erősítő és DAC topik
- Apple MacBook
- Kerékpárosok, bringások ide!
- Proxmox VE
- exHWSW - Értünk mindenhez IS
- Milyen CPU léghűtést vegyek?
- Xiaomi 12 - az izmos 12
- További aktív témák...
- AMD Radeon Pro W5500 8GB GDDR6 128bit
- DDR4 Szerver RAM felvásárlás - napi árak, elsősorban nagy mennyiségben
- Thinkpad P1 Gen2 15.6" FHD IPS i7-9750H T1000 16GB 512GB NVMe ujjlolv IR kam új akku gar
- Surface Pro 7 12" 2K IPS érintő i5-1035G4 8GB 256GB NVMe IR kam 790 g gar
- ZBook Fury 16 G9 27% 16" FHD+ IPS érintő i7-12850HX RTX A4500 32GB 1TB NVMe ujjolv IR kam gar
- Honor 90 /12/512GB / Kártyafüggetlen / 12Hó Garancia
- Dell Latitude 5300 13,3" FHD IPS touch, i7 8665U, 8-16GB RAM, SSD, jó akku, számla, 6 hó gar
- ÚJ Lenovo ThinkPad T16 Gen 4 - 16" WUXGA - Ultra 7 255U - 32GB - 1TB SSD - Win11 - 3 év garancia
- GYÁRI TÖLTŐK DELL LENOVO HP FUJITSU TOSHIBA Macbook---------- Budapest,/MPL/Foxpost
- Azonnali készpénzes félkonfig / félgép felvásárlás személyesen / csomagküldéssel korrekt áron
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest

